Here you can find the source of setLanguage(Context context, String language)
public static void setLanguage(Context context, String language)
//package com.java2s; import java.util.Locale; import android.content.Context; import android.content.res.Configuration; import android.content.res.Resources; import android.text.TextUtils; public class Main { public static void setLanguage(Context context, String language) { Locale locale;/*from w ww . j ava2s . c om*/ if (TextUtils.isEmpty(language)) { locale = Locale.getDefault(); } else if (language.length() == 5 && language.charAt(2) == '_') { // language is in the form: en_US locale = new Locale(language.substring(0, 2), language.substring(3)); } else { locale = new Locale(language); } Configuration config = new Configuration(); config.locale = locale; Resources resources = context.getResources(); resources .updateConfiguration(config, resources.getDisplayMetrics()); } }