Android : Android: Programmatically setting Locale doesn't fetch values from values-ta/string.xml

on Saturday, January 31, 2015


I have the following code:



locale = new Locale(loc);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
Resources resources = getResources();
resources.updateConfiguration(config, resources.getDisplayMetrics());
Intent intent = new Intent(getActivity(), Settings.class);
getActivity().finish();
startActivity(intent);


In my Preference settings screen, I obtain the value of ListPreference and onChange of the value the above code snippet is called.


However, the call happens, but the strings don't change to "ta" language. This is done inside a PreferenceFragment which is called by Settings Activity.


Text within the app changes the language to appropriate one, but the text on the toolbar doesn't change.


Can someone guide?


0 comments:

Post a Comment