List of usage examples for android.content.res Configuration setLocales
public void setLocales(@Nullable LocaleList locales)
From source file:ca.appvelopers.mcgillmobile.ui.BaseActivity.java
/** * Updates the locale/* w w w . j a v a 2 s. co m*/ */ private void updateLocale() { Locale locale = new Locale(languagePref.get()); Configuration config = getBaseContext().getResources().getConfiguration(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { config.setLocales(new LocaleList(locale)); } else { //noinspection deprecation config.locale = locale; } getBaseContext().getResources().updateConfiguration(config, getBaseContext().getResources().getDisplayMetrics()); }