Reputation: 1043
I am unable to see my values in my strings.xml When I try to see it in R.id it doesnt exist
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">BPhonelist</string>
<string name="action_add_contact">Add Contact</string>
<string name="action_phone_contact">Phone Contact</string>
<string name="action_work_contact">Phone Work Contact</string>
<string name="action_home_contact">Phone Home Contact</string>
<string name="action_email_contact">Email Contact</string>
<string name="hello_world">Hello world!</string>
<string name="detail_toast_add">Contact Added</string>
</resources>
Please if you know how I can get access it tell me.
Upvotes: 0
Views: 138
Reputation: 2311
R.id.*
values will be generated from layout files using android:id="+@id\myid"
You can reference your strings via the R.string.
prefix.
Upvotes: 1
Reputation: 44571
When I try to see it in R.id it doesnt exist
that's because these are in your strings.xml
. They aren't id resources
. Try accessing with something like
String someString = getResources().getString(R.string.app_name);
This is assuming you are already in the Activity Context
. If not, you will need to have a Context
before getResources()
Upvotes: 1