Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make the Java code to call a String from a XML file(In Android Studio)

I have this code and I will like to make it multi language app. What I want is to use the Strings from the Strings.xml file under the directory of values.

Let's say I have a Toast...

Toast.makeText(getApplicationContext(), "WELCOME", Toast.LENGTH_LONG).show(); 

But I don't want to put the welcome in the java but to get it from the xml file, but How?

like image 982
App The Android Avatar asked Aug 19 '14 10:08

App The Android


1 Answers

Put getString(R.string.welcome) instead of "WELCOME".

like image 153
Héctor Avatar answered Sep 18 '22 10:09

Héctor