Language not installed Programmatically in Android 5.0 Lollipop

My app sets the locale to match the selected language in the app. Before Kitkat, my code works fine. Lollipop was not installed after locale update. Here I am pasting my code to set the locale.

Locale locale = new Locale("de_DE");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, null);

      

+3


source to share


3 answers


You must change the way you initialize the locale. From this:

Locale locale = new Locale("de_DE");

      

:



String language = "de";
String country = "DE";
Locale locale = new Locale(language , country);

      

Check out the full answer here fooobar.com/questions/705205 ​​/ ...

Hooray!

+5


source


you can set the locale to your application using the following code.




Locale locale = new Locale("de", "DE");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, null);

      

+1


source


Check out Lollipop Set Default local doesn't work Try using only language code "de" and not "de_DE".

0


source







All Articles