Here you can find the source of setDefaultLocale(Context context, String locale)
Parameter | Description |
---|---|
locale | To set in the configuration |
public static void setDefaultLocale(Context context, String locale)
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.content.res.Configuration; import java.util.Locale; public class Main { /**//from ww w . ja v a 2 s . c o m * Change the default locale of the application for this activity * * @param locale * To set in the configuration */ public static void setDefaultLocale(Context context, String locale) { Locale locJa = new Locale(locale); Locale.setDefault(locJa); Configuration config = new Configuration(); config.locale = locJa; if (context != null) { context.getResources().updateConfiguration(config, context.getResources().getDisplayMetrics()); } } }