Different ways to get a string resource

What is the difference between getResources().getString(...)and getString()when called from my activity? I read that it getText(...)returns stylized text, but when should I use getResources(), and not directly the caller getString()?

+5
source share
2 answers

They have nothing to do with them if you use the Android source code and especially the Context class for example.

 public final String getString(int resId) {
     return getResources().getString(resId);
 }
+6
source

getString()is a convenient way because it is used regularly (you do not need to enter getResources()...). In addition, they are the same.

+2
source

All Articles