belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
LocaleListCompat
public
final
class
LocaleListCompat
extends Object
java.lang.Object | |
↳ | android.support.v4.os.LocaleListCompat |
Helper for accessing features in LocaleList
.
Summary
Public methods | |
---|---|
static
LocaleListCompat
|
create(Locale... localeList)
Creates a new instance of |
boolean
|
equals(Object other)
|
static
LocaleListCompat
|
forLanguageTags(String list)
Generates a new LocaleList with the given language tags. |
Locale
|
get(int index)
Retrieves the |
static
LocaleListCompat
|
getAdjustedDefault()
Returns the default locale list, adjusted by moving the default locale to its first position. |
static
LocaleListCompat
|
getDefault()
The result is guaranteed to include the default Locale returned by Locale.getDefault(), but not necessarily at the top of the list. |
static
LocaleListCompat
|
getEmptyLocaleList()
Retrieve an empty instance of |
Locale
|
getFirstMatch(String[] supportedLocales)
Returns the first match in the locale list given an unordered array of supported locales in BCP 47 format. |
int
|
hashCode()
|
int
|
indexOf(Locale locale)
Searches this |
boolean
|
isEmpty()
Returns whether the |
int
|
size()
Returns the number of |
String
|
toLanguageTags()
Retrieves a String representation of the language tags in this list. |
String
|
toString()
|
Object
|
unwrap()
Gets the underlying framework object. |
static
LocaleListCompat
|
wrap(Object object)
Creates a new instance of |
Inherited methods | |
---|---|
From
class
java.lang.Object
|
Public methods
create
LocaleListCompat create (Locale... localeList)
Creates a new instance of LocaleListCompat
from the Locale
array.
Parameters | |
---|---|
localeList |
Locale |
Returns | |
---|---|
LocaleListCompat |
equals
boolean equals (Object other)
Parameters | |
---|---|
other |
Object |
Returns | |
---|---|
boolean |
forLanguageTags
LocaleListCompat forLanguageTags (String list)
Generates a new LocaleList with the given language tags.
Note that for API < 24 only the first language tag will be used.>
Parameters | |
---|---|
list |
String : The language tags to be included as a single String separated by commas. |
Returns | |
---|---|
LocaleListCompat |
A new instance with the Locale items identified by the given tags.
|
get
Locale get (int index)
Retrieves the Locale
at the specified index.
Parameters | |
---|---|
index |
int : The position to retrieve. |
Returns | |
---|---|
Locale |
The Locale in the given index
|
getAdjustedDefault
LocaleListCompat getAdjustedDefault ()
Returns the default locale list, adjusted by moving the default locale to its first position.
Returns | |
---|---|
LocaleListCompat |
getDefault
LocaleListCompat getDefault ()
The result is guaranteed to include the default Locale returned by Locale.getDefault(), but not necessarily at the top of the list. The default locale not being at the top of the list is an indication that the system has set the default locale to one of the user's other preferred locales, having concluded that the primary preference is not supported but a secondary preference is.
Note that for API >= 24 the default LocaleList would change if Locale.setDefault() is called. This method takes that into account by always checking the output of Locale.getDefault() and recalculating the default LocaleList if needed.
Returns | |
---|---|
LocaleListCompat |
getEmptyLocaleList
LocaleListCompat getEmptyLocaleList ()
Retrieve an empty instance of LocaleList
.
Returns | |
---|---|
LocaleListCompat |
getFirstMatch
Locale getFirstMatch (String[] supportedLocales)
Returns the first match in the locale list given an unordered array of supported locales in BCP 47 format.
Parameters | |
---|---|
supportedLocales |
String |
Returns | |
---|---|
Locale |
The first Locale from this list that appears in the given array, or
null if the LocaleListCompat is empty.
|
hashCode
int hashCode ()
Returns | |
---|---|
int |
indexOf
int indexOf (Locale locale)
Searches this LocaleListCompat
for the specified Locale
and returns the
index of the first occurrence.
Parameters | |
---|---|
locale |
Locale : The Locale to search for. |
Returns | |
---|---|
int |
The index of the first occurrence of the Locale or -1 if the item
wasn't found
Value is -1 or greater. |
isEmpty
boolean isEmpty ()
Returns whether the LocaleListCompat
contains no Locale
items.
Returns | |
---|---|
boolean |
true if this LocaleListCompat has no Locale items,
false otherwise
|
size
int size ()
Returns the number of Locale
items in this LocaleListCompat
.
Returns | |
---|---|
int |
toLanguageTags
String toLanguageTags ()
Retrieves a String representation of the language tags in this list.
Returns | |
---|---|
String |
toString
String toString ()
Returns | |
---|---|
String |
unwrap
Object unwrap ()
Gets the underlying framework object.
Returns | |
---|---|
Object |
an android.os.LocaleList object if API >= 24 , or Locale if not.
|
wrap
LocaleListCompat wrap (Object object)
Creates a new instance of LocaleListCompat
from the Locale list.
Parameters | |
---|---|
object |
Object |
Returns | |
---|---|
LocaleListCompat |