Example usage for android.os LocaleList LocaleList

List of usage examples for android.os LocaleList LocaleList

Introduction

In this page you can find the example usage for android.os LocaleList LocaleList.

Prototype

public LocaleList(@NonNull Locale... list) 

Source Link

Document

Creates a new LocaleList .

Usage

From source file:ca.appvelopers.mcgillmobile.ui.BaseActivity.java

/**
 * Updates the locale//  www . j ava2  s  . com
 */
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());
}

From source file:com.android.settings.localepicker.LocaleDragAndDropAdapter.java

public void doTheUpdate() {
    int count = mFeedItemList.size();
    final Locale[] newList = new Locale[count];

    for (int i = 0; i < count; i++) {
        final LocaleStore.LocaleInfo li = mFeedItemList.get(i);
        newList[i] = li.getLocale();/*w ww .  j a v  a2  s . com*/
    }

    final LocaleList ll = new LocaleList(newList);
    updateLocalesWhenAnimationStops(ll);
}