我想从设置中更改应用程序的语言。如何从SettingsActivity更改应用程序的区域设置?
public boolean onPreferenceChange(Preference preference, Object value) {
String stringValue = value.toString();
if (preference instanceof ListPreference) {
// For list preferences, look up the correct display value in
// the preference's 'entries' list.
ListPreference listPreference = (ListPreference) preference;
int index = listPreference.findIndexOfValue(stringValue);
// Set the summary to reflect the new value.
preference.setSummary(index >= 0 ? listPreference.getEntries()[index]: null);
.............
这里,设置活动里面我们怎么能访问的配置和应用程序的语言环境来改变它的语言。
仅供参考,我已将值转换为字符串。
这是http://stackoverflow.com/questions/13181847/change-the-locale-at-runtime的副本? – k3b