1
In the Android application you can translate the xml string. How do I do this in the java code?
In this code, for example:
Toast.makeText(getApplicationContext(), "Carregando o aplicativo", Toast.LENGTH_SHORT).show();
1
In the Android application you can translate the xml string. How do I do this in the java code?
In this code, for example:
Toast.makeText(getApplicationContext(), "Carregando o aplicativo", Toast.LENGTH_SHORT).show();
5
You have the file res/values/strings.xml, correct?
Then you must create a new directory values referring to the language you want to use in the APP, for example:
And in Toast, instead of putting the text right there, you would pull from R.string. for example
It will work according to the default language of the user’s device, if the user’s device is set to French, Java will automatically fetch the texts in res/values-fr/strings.xml
Browser other questions tagged java android
You are not signed in. Login or sign up in order to post.
Very well explained. It worked, thank you very much!
– user41630