4

I'm trying to change the language of the whole system of Android Phone on my application, cause our goal is to customized a Settings application.

I've tried this, but didn't work:

Configuration conf = Resources.getSystem().getConfiguration();

conf.locale = toSet;  //toSet is a Locale which I want to set to the system

conf.setToDefaults();

the other try didn't work either:

Locale.setDefault(toSet)

There are ways to change the language of application, but not systems.

Is there any ways that I can reach the goal? Will getting the root permissions works for me? Or is there any ways to modify the UI interface of the Intent-Activity?

I've found that, in the source code, "platform/packages/apps/Settings/src/com/android/settings/LocalePicker.java", "com.android.internal.app.LocalePicker" might help, and in the "platform/frameworks/base/core/java/com/android/internal/app", there is a function which named "updateLocale", I guess it might help, but the class such as "IActivityManager" cause compile error in the Eclipse.

Does anyone have any ideas? Thanks!

4

1 回答 1

1

尝试这个

String languageToLoad = "zh";  
Locale locale = new Locale(languageToLoad);  
Locale.setDefault(locale);  
Configuration config = new Configuration();  
config.locale = locale;  
getBaseContext().getResources().updateConfiguration(config, null);

安卓清单:

添加android:configChanges="locale"

于 2012-04-26T12:08:24.860 回答