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. How can I get its string value? I mentioned the string value in the string.xml
file.
Try this
String mess = getResources().getString(R.string.mess_1);
UPDATE
String string = getString(R.string.hello);
You can use either getString(int)
or getText(int)
to retrieve a string. getText(int)
will retain any rich text styling applied to the string.
Reference: https://developer.android.com/guide/topics/resources/string-resource.html