my problem is i am using below code for setting locale language dynamically. Its changing the default locale but after calling onResume() while i want to run it immediately as i am at very first page of my app.
locale = new Locale("de");
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
EDIT:
Save choosen language in SharedPref:
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
SharedPreferences.Editor editor = preferences.edit();
editor.putString("Lang",ChoosenLang);
editor.commit();
get Value in onCreate
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
String Language = preferences.getString("Lang","de");
if (Language != null && !Language.isEmpty()) {
// Your Language code here
locale = new Locale(Language); // Language=de
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics());
}