Locale is working fine for Oreo,Pie and Q versions.But for Nougat,Marshmallow and Lollipop, it is not changing the language.Any help will be highly appreciated.Thanks
Configuration config = new Configuration();
if (Build.VERSION.SDK_INT >= 24) {
config.setLocale(locale);
getBaseContext().getResources().updateConfiguration(config,
getBaseContext().getResources().getDisplayMetrics());
} else {
config.setLocale(locale);
config.setLayoutDirection(locale);
getBaseContext().getApplicationContext().createConfigurationContext(config);
}