As I Know the following thing.
A resource ID is a 32 bit number of the form: PPTTNNNN. PP is the package the resource is for; TT is the type of the resource; NNNN is the name of the resource in that type. For applications resources, PP is always 0x7f.
Example :
these resource files handled by aapt in this order:
layout/main.xml
drawable/icon.xml
layout/listitem.xml
The first type we see is layout
so that is given TT == 1
. The first name under that type is "main" so that is given NNNN == 1
. The final resource ID is 0x7f010001
.
Next we see drawable
so that is given TT == 2
. The first name for that type is "icon" so that gets NNNN == 1
. The final resource ID is 0x7f020001
.
Last we see another layout
which has TT == 1
as before. This has a new name listitem
so that gets the next value NNNN == 2
. The final resource ID is 0x7f010002
.
Question :
But Recently I see some of the layout file are assign ID by below way.
java code
this.f5160k = (ImageView) findViewById(2131755224);
this.f5163n = findViewById(2131755219);
this.f5162m = (LinearLayout) findViewById(2131755223);
this.f5161l = (LinearLayout) findViewById(2131755220);
this.f5158i = (GridView) findViewById(2131755222);
As the first part this.f5160k
is Declartion as i know but what is this format 2131755224
. can one Anyone give me Suggestion or Knowledge. ?
2131755224
is the decimal representation of 0x7F1000D8
In the code that you shared, developer decided to hardcoded the decimal number instead of using the hexadecimal format. However, both has the same value and are pointing to same resourceID.
You can choose to use 2131755224
or 0x7F1000D8
.
In R.java, you can find the IDs in hexadecimal format.