0

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.

1
  • 1
    String resources would be in R.string, not R.id Commented Dec 8, 2013 at 18:44

2 Answers 2

1

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()

Sign up to request clarification or add additional context in comments.

Comments

1

R.id.* values will be generated from layout files using android:id="+@id\myid"

You can reference your strings via the R.string. prefix.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.