moesef
moesef

Reputation: 4841

Integer resource not what expected

I have the following integer resources in my strings.xml file

<item type="integer" name="pID" format="integer">374</item>
<item type="integer" name="vID" format="integer">3468</item>

I want to call them from my code to get 374 and 3468.

However, when I output to Logcat...

Log.d("MainActivity.onCreate","pID: "+R.integer.pID+" vID: "+R.integer.vID);

I see the following...

pID: 2131230720 vID: 2131230721

Why are R.integer.vID and R.integer.pID returning ints other than 3468 and 374 respectivley?

Upvotes: 0

Views: 455

Answers (1)

harism
harism

Reputation: 6073

You are printing out the resource IDs. Use Resources.getInteger(resourceId) instead.

http://developer.android.com/guide/topics/resources/more-resources.html#Integer

Upvotes: 4

Related Questions