Java tutorial
//package com.java2s; //License from project: Open Source License import android.content.res.Configuration; import android.content.res.Resources; import android.util.DisplayMetrics; import java.util.Locale; public class Main { public static void setLocale(String lang, Resources res) { Locale myLocale; if (lang.equalsIgnoreCase("zh-rTW")) { myLocale = Locale.TRADITIONAL_CHINESE; } else if (lang.equalsIgnoreCase("zh-rCN") || lang.equalsIgnoreCase("zh")) { myLocale = Locale.SIMPLIFIED_CHINESE; } else if (lang.equalsIgnoreCase("pt-rBR") || lang.equalsIgnoreCase("pt")) { myLocale = new Locale("pt", "BR"); } else if (lang.equalsIgnoreCase("pt-rPT")) { myLocale = new Locale("pt", "PT"); } else { myLocale = new Locale(lang); } DisplayMetrics dm = res.getDisplayMetrics(); Configuration conf = res.getConfiguration(); conf.locale = myLocale; res.updateConfiguration(conf, dm); } }