0

I added some strings to the strings.xml file, as the following:

<string name="29">Beaf Stake"</string>

I know that this is the way to retrieve strings from the ressources:

getResources().getString(R.string.29);

But the problem is that I don't find this string listed in R.string. I imported my Project's R as following:

import xxxx.xx.xxxx.xxx.R;

I tried restarting Eclipse with no luck, so what am I doing wrong?

2 Answers 2

3

Having a numeric variable name is wrong . It won't allow such thing and instead throw an error.

I request you to change your string name. May be follow the recommendations Are there conventions on how to name resources?

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

1 Comment

Yes you were right! I changed the string name to something other than numeric and I works. I would accept the answer as soon as possible!
0

Your resource name can't start with a number and you have to escape quotes either with an esacape character or enclose the whole sting.

<string name="29">Beaf Stake"</string>

should be

<string name="29">"Beaf Stake"</string>

or

<string name="29">Beaf Stake/"</string>

Link

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.