I've got the following issue - Locale can't be changed on my device running 4.4.2 (Gigabyte Mika M3), but it is perfectly working in android emulator running API 26.
I'm changing locale in the following way:
Resources resources = getResources();
Configuration configuration = resources.getConfiguration();
DisplayMetrics displayMetrics = resources.getDisplayMetrics();
configuration.setLocale(locale);
resources.updateConfiguration(configuration,displayMetrics);
getApplicationContext().createConfigurationContext(configuration);
I also tried that way - but it's not working too:
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
I store location as string in shared preferences like this:
SharedPreferences sharedPreferences = getSharedPreferences("languages", MODE_PRIVATE);
SharedPreferences.Editor editor = sharedPreferences.edit();
editor.putString("language", locale.getLanguage());
editor.apply();
and after all of this i'm recreating activity
Intent refresh = new Intent(ChooseLanguageActivity.this, ChooseLanguageActivity.class);
startActivity(refresh);
finish();
The problem is - recreated activity (this) opens with the same language as earlier and application on restart opens with default locale :C