I want to change the locale within my app. I have several strings.xml
file depending on various locales.Issue I am facing is the app locale gets updated but the strings like in title or tabs header doesn't gets updated depending on locale changed.
I have killed my app using System.exit(0)
and manually restarted it but changes doesn't gets reflected. Please help.
Locale locale = new Locale(language);
Locale.setDefault(locale);
Resources res = context.getResources();
Configuration config = new Configuration(res.getConfiguration());
if (Build.VERSION.SDK_INT >= 17) {
config.setLocale(locale);
context = context.createConfigurationContext(config);
} else {
config.locale = locale;
res.updateConfiguration(config, res.getDisplayMetrics());
}
res.updateConfiguration(config, res.getDisplayMetrics());