guys... I am stuck with problem after app developed. Now We have a new requirement to change whole application language if user selects the German language. So how to handle this?
Asked
Active
Viewed 238 times
0
-
Did you check [this](https://stackoverflow.com/a/4640910/5132804)? – Alberto S. Jun 20 '17 at 06:57
-
Have you dig a google ? You can find many solutions – Piyush Jun 20 '17 at 06:57
-
1Possible duplicate of [Change language programmatically in Android](https://stackoverflow.com/questions/2900023/change-language-programmatically-in-android) – Jameido Jun 20 '17 at 06:59
-
Better to delete question due to duplicate question, otherwise get negative rating. – Nitin Patel Jun 20 '17 at 07:08
-
Pelocho Yes, I tried this. But didn't work with me. – Nirali Desai Jun 20 '17 at 09:01
1 Answers
0
Use this:
Resources res = context.getResources();
// Change locale settings in the app.
DisplayMetrics dm = res.getDisplayMetrics();
android.content.res.Configuration conf = res.getConfiguration();
conf.setLocale(new Locale(language_code.toLowerCase()); // API 17+ only.
// Use conf.locale = new Locale(...) if targeting lower versions
res.updateConfiguration(conf, dm);
For more info check this link : Change language programmatically in Android

sumit
- 1,047
- 1
- 10
- 15