I have this method running on most of android API versions to set app using language (strings etc)
protected void setDefaultLocale(Context context, Locale locale) {
Locale.setDefault(locale);
Configuration appConfig = new Configuration();
appConfig.locale = locale;
context.getResources()
.updateConfiguration(appConfig, context.getResources().getDisplayMetrics());
System.out.println("trad" + locale.getLanguage());
}
@Override
protected void onCreate(Bundle savedInstanceState) {
SharedPreferences sharedPref = PreferenceManager.getDefaultSharedPreferences(this);
String language = sharedPref.getString("pref_language", "he_IL");
if (!language.equals(""))
setDefaultLocale(this, new Locale(language));
super.onCreate(savedInstanceState);
}
When using this on lollipop running device nothing change.
Anyone know how to solve this?