Let's imagine we had this text inside values/strings.xml
<string name="some_text">HELLO WORLD</string>
I can call this string from anywhere inside my project like so:
String s = String.valueOf(R.string.some_text);
Today I learnt this other way to do exactly the same job:
String s = getResources().getString(R.string.some_text);
Does anyone know if there is any advantage in using the second way? The first one seems shorter and easier to remember.
Thanks
String.valueOf( )working. Intriguing if true as then I wouldn't need to callgetResources( )from odd locations that might not have immediate access to them.