Example usage for android.os LocaleList get

List of usage examples for android.os LocaleList get

Introduction

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

Prototype

public Locale get(int index) 

Source Link

Document

Retrieves the Locale at the specified index.

Usage

From source file:ru.dublgis.androidhelpers.DesktopUtils.java

public static String getUserLocaleNames(final Context context) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) { // API 24 / Android 7.0
        try {/*  w w  w .  jav a 2 s  . c  om*/
            final LocaleList list = context.getResources().getConfiguration().getLocales();
            if (list.size() > 0) {
                String result = "";
                for (int i = 0; i < list.size(); ++i)
                    result += list.get(i).toString() + "\n";
                return result;
            }
        } catch (final Throwable e) {
            Log.e(TAG, "getUserLocaleNames exception: ", e);
        }
    }
    return getDefaultLocaleName(context);
}