Created
March 19, 2014 08:58
-
-
Save john990/9637973 to your computer and use it in GitHub Desktop.
android change app language.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 设置时调用一次,程序启动时调用一次 | |
private static void updateActivity(String locate, Context context) { | |
// 本地语言设置 | |
Locale myLocale = new Locale(locate); | |
Resources res = context.getResources(); | |
DisplayMetrics dm = res.getDisplayMetrics(); | |
Configuration conf = res.getConfiguration(); | |
conf.locale = myLocale; | |
// 更新全局Configuration | |
res.updateConfiguration(conf, dm); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Nice