Tobias Moe Thorstensen Tobias Moe Thorstensen - 2 months ago 20
Android Question

Getting strings from the strings.xml file

I'm currently working on internationalization to my android application. This is the way I try to get the strings from the

string.xml


tv.setText(context.getResources().getString(R.string.));


But Eclipse does not suggest any of my pre defined strings, just the standard
Android Strings
. My Folder structure look like this:

res/values/strings.xml


and

res/values-NO/strings.xml


I can see that the strings in these to files has some memory addresses in the
R.java
file, like this one for instance:

public static final int enterPassword=0x7f06003c;


I tried to
Clean
the Project, but its strange that eclipse doesnt suggest anything, the string exist in the
R.java


Where is the problem ?

Answer

You should import you R class.

import xxx.xxx.R;

not

import android.R;