Issue
I know this may be a dumb question to some, but what exactly does 'Extract String Resource" in Android Studio do? I know that it updates the strings.xml file, but why do we extract it? What is the point of it? And I'm not sure when to use it? Thank you for your help and time! (I'm new to Android Studio).
Solution
why do we extract it?
To take a literal string, hard-coded somewhere, and replace it with a string resource and a reference to that string resource. So, you turn something like:
btnSomething.setText("Foo");
with:
btnSomething.setText(R.string.foo);
and a <string>
resource named foo
with a default value of Foo
.
Principally, you use string resources for translations. So, res/values/strings.xml
might hold US English strings, but res/values-fr/strings.xml
would hold French strings, and so on.
Answered By - CommonsWare
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.