Example usage for android.os LocaleList size

List of usage examples for android.os LocaleList size

Introduction

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

Prototype

@IntRange(from = 0)
public int size() 

Source Link

Document

Returns the number of Locale items in this LocaleList .

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 {/*from ww w  . j ava 2 s .c  o  m*/
            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);
}