Skip to content

Instantly share code, notes, and snippets.

@korniltsev
Created February 22, 2013 15:15
Show Gist options
  • Save korniltsev/5014112 to your computer and use it in GitHub Desktop.
Save korniltsev/5014112 to your computer and use it in GitHub Desktop.
Change locale in runtime
public void setLocale(String lang) {
myLocale = new Locale(lang);
Resources res = getResources();
DisplayMetrics dm = res.getDisplayMetrics();
Configuration conf = res.getConfiguration();
conf.locale = myLocale;
res.updateConfiguration(conf, dm);
Intent refresh = new Intent(this, AndroidLocalize.class);
startActivity(refresh);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment