Reputation: 27
How do I call the real value integer from res/values/stings.xml like below
<integer name="GUI_OK">0x9001</integer>
<integer name="GUI_Error">0x9002</integer>
R.Integer.GUI_OK is an int(2131230720) not the real value
Upvotes: 1
Views: 1053
Reputation: 17874
First, don't put them in strings.xml
. Put them in integers.xml
.
Second, you should use context.getResources().getInteger(R.integer.GUI_OK)
, where context
is an instance of a Context object, such as an Activity or Service.
R.integer.GUI_OK
is simply a resource value which Android uses to retrieve the actual value of that resource.
Upvotes: 1