Skip to content

Instantly share code, notes, and snippets.

@john990
Created March 19, 2014 08:58
Show Gist options
  • Save john990/9637973 to your computer and use it in GitHub Desktop.
Save john990/9637973 to your computer and use it in GitHub Desktop.
android change app language.
// 设置时调用一次,程序启动时调用一次
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);
}
@xlmnxp
Copy link

xlmnxp commented Jun 20, 2018

Nice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment