Some Strings Are Not Translated When Changing System Language Without Restarting App
I'm having a problem where if I open my android app and then go into the system settings to change the language and then open the app again, some strings in the app won't be transl
Solution 1:
I also had this issue.I used the code below which was posted in some StackOverflow answer and then it changed the language without refreshing the activity
publicvoidsetLocale(String lang) {
myLocale = newLocale(lang);
Resourcesres= getResources();
DisplayMetricsdm= res.getDisplayMetrics();
Configurationconf= res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
onConfigurationChanged(conf);
}
@OverridepublicvoidonConfigurationChanged(Configuration newConfig) {
// refresh your views here
lblLang.setText(R.string.langselection);
super.onConfigurationChanged(newConfig);
}
I hope it would help you.......
Post a Comment for "Some Strings Are Not Translated When Changing System Language Without Restarting App"