What is the difference between getResources().getString(...)
and getString()
when called from my activity? I read that getText(...)
returns stylized text, but when should I use getResources(
) as opposed to directly calling getString()
?
They are the same nothing special about them if you fetch the Android source code and specially the Context Class for exemple
public final String getString(int resId) {
return getResources().getString(resId);
}
getString()
is a convenient way since it is used regularly (you don't need to type getResources()
…). Other than that, they're same.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With