UMAR-MOBITSOLUTIONS UMAR-MOBITSOLUTIONS - 1 year ago 56
Android Question

how to read value from string.xml in android?

I have written the line:

String Mess= R.string.mess_1 ;


to get string value, but instead of returning string, it is giving me id of type integer. Can anyone guide me as to how I can get its string value? I mentioned the string value in the
string.xml
file.

Any help would be appreciated.

Answer Source

Try this

String mess = getResources().getString(R.string.mess_1);

More info here