/** * Sets the system locale to the new one specified. * * @param locale A locale name in the form "ab_AB". Must not be null or empty. * @return True if the locale was succesfully changed. */ public static boolean changeSystemLocale(String locale) { if (DEBUG) { Log.d(TAG, "Change locale to: " + locale); } try { IActivityManager am = ActivityManagerNative.getDefault(); Configuration config = am.getConfiguration(); Locale loc = null; String[] langCountry = locale.split("_"); if (langCountry.length == 2) { loc = new Locale(langCountry[0], langCountry[1]); } else { loc = new Locale(locale); } config.locale = loc; // indicate this isn't some passing default - the user wants this // remembered config.userSetLocale = true; am.updateConfiguration(config); return true; } catch (RemoteException e) { if (DEBUG) { Log.e(TAG, "Change locale failed", e); } } return false; }