如何改变整个系统的语言设置在android系统没有意图是什么? [英] How to change language setting of the whole system in android without Intent?
问题描述
我想改变的整个Android手机在我的应用系统的语言,使我们的目标是一个定制设置应用程序。
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.
有没有办法,我能达到目标的方法吗?
将获得root权限对我的作品?
还是有修改的意向活动的UI界面的方法呢?
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?
我发现,在源$ C $ C,平台/封装/应用/设置/ src目录/ COM /安卓/设置/ LocalePicker.java,com.android。 internal.app.LocalePicker也许会有帮助,并在平台/框架/基/核心/ JAVA / COM /安卓/内部/应用,
有一个名为哪些功能updateLocale,我猜测它可能会帮助,但是类,如在EclipseIActivityManager导致编译错误。
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!
推荐答案
试试这个
String languageToLoad = "zh";
Locale locale = new Locale(languageToLoad);
Locale.setDefault(locale);
Configuration config = new Configuration();
config.locale = locale;
getBaseContext().getResources().updateConfiguration(config, null);
AndroidManifest:
AndroidManifest:
添加的android:configChanges =区域设置
这篇关于如何改变整个系统的语言设置在android系统没有意图是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!