I am developing an android application in which there is a drop down button,drop down is having 3 languages as option,on selecting a particular language,the entire application should change to that language.My application is ready with drop down button having 3 languages as its option,but i don't know how to change entire application in that particular chosen language.Please help me on this....
Asked
Active
Viewed 343 times
-1
-
Perhaps you could create a separate layout for each language and replace it based on the selection? – Raul Marengo Jan 18 '12 at 11:50
-
Either this, or create a table which maps a language to a list of strings. When user selects different language you will need to pull strings from that table and manually set new text labels for all UI controls in code – Anton Jan 18 '12 at 12:58
-
Geesh, people start reading questions before casting your votes.. – Anton Jan 18 '12 at 13:08
3 Answers
1
For this you have to make a different String.xml in three language.
btw what type of data you want to show is that a static or get from other resource.

deepak Sharma
- 1,641
- 10
- 23
1
Android is designed to support localization. You can achieve your aim by adding alternative String.xml files each stored in a locale-specific resource directory. There is plenty of information about localization in Android Developer's Dev Guide.
Here is the link: http://developer.android.com/guide/topics/resources/localization.html
Also a problem similar to yours was already discussed: multilanguage app: best way?

Community
- 1
- 1

Korhan Ozturk
- 11,148
- 6
- 36
- 49
-
I believe the question is not how to support changes in system locale, but rather how to allow the user to select a different language within the app. And that functionality is not greatly supported by the Android framework – Anton Jan 18 '12 at 12:57
-
Anton, you are right, but I think this is the case by design. If the user sets his phone to a preferred language, why should he want to switch the language of a single app to another language. In my opinion, the app shouldn't try to bypass android i18n mechanisms. – henrik Jan 18 '12 at 13:42
-1
Button s = (Button) findViewById(R.id.ProfileLanguageButtton);
s.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
try {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.setClassName("com.android.settings",
"com.android.settings.LanguageSettings");
startActivity(intent);
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
}
});

Prashant Mishra
- 627
- 5
- 18