Reputation: 11012
When editing my strings.xml under res/values I can see them appearing in gen/my_package/R.java but they are static final int's, why is this?
-Why are they static final, presumably this means I couldn't update them, i.e. if I assign a string to a text box, can that string be updated from my code at some point to update the contents of the text box?
-Also why are these integers, specifically they appear to be hex values. If this is the preferable way of declaring these values, why don't we just declare them as hex values in the first place?
Upvotes: 3
Views: 582
Reputation: 31503
The int it generates is used by android to retrieve your String. You must have a reference to Context (such as an Activity) in order to get your resources. For example in your activity you could say.
this.getString(R.string.myString);
the getString in Activity
is a shortcut to
context.getResources().getString(R.string.myString);
Hope this helps!
Upvotes: 8