I am trying the understand the internal workings of R.java and localization in Android.I know that the strings are compile time resources and are generated by the apt. I have several questions regarding R.java .
1.If I open the R.java generated file I can see
public final class R {
public static final class string {
public static final int HelloMessage=0x7f05000f;
}Why is R.String.HelloMessage is int.And if it's static final how the localized version works with the same int as I cannot see any localized version of the variable.
2.How the switching to locales happen??Can someone point me to the android source code.I have browsed the code for android.content.res.AssetManager,com.android .settings.LocalePicker.java but I am not sure how behind the scene R.Java is loading the localized strings.
Thanks
Abhijit
I just had one understanding about R.java that I think it save constant reference of any id on .xml as a integer; the integer value is refer to item that declared on .xml file.
As i know xml is created items for each tag to tag end ex: <Textview></Textview> (you can search for better understanding of xml)
, and the way .java connect to .xml is with refer to id of item on xml that generated by android framework when you created an item on .xml
And R.java is saved the id of item as a constant variable that named like the item named
Like when you declare something
Like :
class Circle {
public final int PI = 3.14;
}
So if you use the 3.14 value of the circle class u will use like: Circle.PI
Similarly with with R.java
U use for example R.id.textview, so that it will refer to id of textView from the layout.xml
--
You received this message because you are subscribed to the Google Groups "android-platform" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-platfo...@googlegroups.com.
To post to this group, send email to android-...@googlegroups.com.
Visit this group at http://groups.google.com/group/android-platform.
For more options, visit https://groups.google.com/d/optout.