# LocaleListCompat

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#)  

# LocaleListCompat

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public

final

class
LocaleListCompat
`  
`

extends Object


``


`

|---|----------------------------------------|
| java.lang.Object                          ||
| ↳ | android.support.v4.os.LocaleListCompat |

<br />

*** ** * ** ***

Helper for accessing features in[LocaleList](https://developer.android.com/reference/android/os/LocaleList.html).

## Summary

|                                                                                                                                                                                                                                           ### Public methods                                                                                                                                                                                                                                            ||
|--------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` static `[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[create](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#create(java.util.Locale...))`(Locale... localeList) ` Creates a new instance of[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)from the[Locale](https://developer.android.com/reference/java/util/Locale)array.                              |
| ` boolean`                                                                                                   | ` `[equals](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#equals(java.lang.Object))`(Object other) `                                                                                                                                                                                                                                                     |
| ` static `[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[forLanguageTags](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#forLanguageTags(java.lang.String))`(String list) ` Generates a new LocaleList with the given language tags.                                                                                                                                                                           |
| ` Locale`                                                                                                    | ` `[get](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#get(int))`(int index) ` Retrieves the[Locale](https://developer.android.com/reference/java/util/Locale)at the specified index.                                                                                                                                                                    |
| ` static `[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[getAdjustedDefault](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#getAdjustedDefault())`() ` Returns the default locale list, adjusted by moving the default locale to its first position.                                                                                                                                                           |
| ` static `[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[getDefault](https://developer.android.com/reference/android/support/v4/os/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](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[getEmptyLocaleList](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#getEmptyLocaleList())`() ` Retrieve an empty instance of[LocaleList](https://developer.android.com/reference/android/os/LocaleList.html).                                                                                                                                          |
| ` Locale`                                                                                                    | ` `[getFirstMatch](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#getFirstMatch(java.lang.String[]))`(String[] supportedLocales) ` Returns the first match in the locale list given an unordered array of supported locales in BCP 47 format.                                                                                                             |
| ` int`                                                                                                       | ` `[hashCode](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#hashCode())`() `                                                                                                                                                                                                                                                                             |
| ` int`                                                                                                       | ` `[indexOf](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#indexOf(java.util.Locale))`(Locale locale) ` Searches this[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)for the specified[Locale](https://developer.android.com/reference/java/util/Locale)and returns the index of the first occurrence. |
| ` boolean`                                                                                                   | ` `[isEmpty](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#isEmpty())`() ` Returns whether the[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)contains no[Locale](https://developer.android.com/reference/java/util/Locale)items.                                                                      |
| ` int`                                                                                                       | ` `[size](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#size())`() ` Returns the number of[Locale](https://developer.android.com/reference/java/util/Locale)items in this[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat).                                                                             |
| ` String`                                                                                                    | ` `[toLanguageTags](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#toLanguageTags())`() ` Retrieves a String representation of the language tags in this list.                                                                                                                                                                                            |
| ` String`                                                                                                    | ` `[toString](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#toString())`() `                                                                                                                                                                                                                                                                             |
| ` Object`                                                                                                    | ` `[unwrap](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#unwrap())`() ` Gets the underlying framework object.                                                                                                                                                                                                                                           |
| ` static `[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | ` `[wrap](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#wrap(java.lang.Object))`(Object object) ` Creates a new instance of[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)from the Locale list.                                                                                                       |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### create

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LocaleListCompat create (Locale... localeList)
```

Creates a new instance of[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)from the[Locale](https://developer.android.com/reference/java/util/Locale)array.

<br />

|          Parameters           ||
|--------------|-----------------|
| `localeList` | `Locale` <br /> |

|                                                  Returns                                                   ||
|----------------------------------------------------------------------------------------------------|--------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | <br /> |

### equals

```
boolean equals (Object other)
```

<br />

<br />

|        Parameters        ||
|---------|-----------------|
| `other` | `Object` <br /> |

|      Returns      ||
|-----------|--------|
| `boolean` | <br /> |

### forLanguageTags

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

|                                                                         Parameters                                                                          ||
|--------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `list` | `String`: The language tags to be included as a single[String](https://developer.android.com/reference/java/lang/String)separated by commas. <br /> |

|                                                                                                                 Returns                                                                                                                 ||
|----------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | A new instance with the[Locale](https://developer.android.com/reference/java/util/Locale)items identified by the given tags. <br /> |

### get

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Locale get (int index)
```

Retrieves the[Locale](https://developer.android.com/reference/java/util/Locale)at the specified index.

<br />

|                    Parameters                    ||
|---------|-----------------------------------------|
| `index` | `int`: The position to retrieve. <br /> |

|                                                 Returns                                                  ||
|----------|------------------------------------------------------------------------------------------------|
| `Locale` | The[Locale](https://developer.android.com/reference/java/util/Locale)in the given index <br /> |

### getAdjustedDefault

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LocaleListCompat getAdjustedDefault ()
```

Returns the default locale list, adjusted by moving the default locale to its first position.

<br />

|                                                  Returns                                                   ||
|----------------------------------------------------------------------------------------------------|--------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | <br /> |

### getDefault

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
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.

<br />

<br />

|                                                  Returns                                                   ||
|----------------------------------------------------------------------------------------------------|--------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | <br /> |

### getEmptyLocaleList

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LocaleListCompat getEmptyLocaleList ()
```

Retrieve an empty instance of[LocaleList](https://developer.android.com/reference/android/os/LocaleList.html).

<br />

|                                                  Returns                                                   ||
|----------------------------------------------------------------------------------------------------|--------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | <br /> |

### getFirstMatch

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Locale getFirstMatch (String[] supportedLocales)
```

Returns the first match in the locale list given an unordered array of supported locales in BCP 47 format.

<br />

|             Parameters              ||
|--------------------|-----------------|
| `supportedLocales` | `String` <br /> |

|                                                                                                                                Returns                                                                                                                                ||
|----------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `Locale` | The first[Locale](https://developer.android.com/reference/java/util/Locale)from this list that appears in the given array, or`null`if the[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)is empty. <br /> |

### hashCode

```
int hashCode ()
```

<br />

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### indexOf

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int indexOf (Locale locale)
```

Searches this[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)for the specified[Locale](https://developer.android.com/reference/java/util/Locale)and returns the index of the first occurrence.

<br />

|                                                   Parameters                                                   ||
|----------|------------------------------------------------------------------------------------------------------|
| `locale` | `Locale`: The[Locale](https://developer.android.com/reference/java/util/Locale)to search for. <br /> |

|                                                                                 Returns                                                                                 ||
|-------|------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | The index of the first occurrence of the[Locale](https://developer.android.com/reference/java/util/Locale)or`-1`if the item wasn't found Value is -1 or greater. |

### isEmpty

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
boolean isEmpty ()
```

Returns whether the[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)contains no[Locale](https://developer.android.com/reference/java/util/Locale)items.

<br />

|                                                                                                             Returns                                                                                                             ||
|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `boolean` | `true`if this[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)has no[Locale](https://developer.android.com/reference/java/util/Locale)items,`false`otherwise <br /> |

### size

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
int size ()
```

Returns the number of[Locale](https://developer.android.com/reference/java/util/Locale)items in this[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat).

<br />

|    Returns    ||
|-------|--------|
| `int` | <br /> |

### toLanguageTags

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
String toLanguageTags ()
```

Retrieves a String representation of the language tags in this list.

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

### toString

```
String toString ()
```

<br />

<br />

|     Returns      ||
|----------|--------|
| `String` | <br /> |

### unwrap

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
Object unwrap ()
```

Gets the underlying framework object.

<br />

|                                                                   Returns                                                                    ||
|----------|------------------------------------------------------------------------------------------------------------------------------------|
| `Object` | an android.os.LocaleList object if API \>= 24 , or[Locale](https://developer.android.com/reference/java/util/Locale)if not. <br /> |

### wrap

added in[version 26.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
LocaleListCompat wrap (Object object)
```

Creates a new instance of[LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)from the Locale list.

<br />

|        Parameters         ||
|----------|-----------------|
| `object` | `Object` <br /> |

|                                                  Returns                                                   ||
|----------------------------------------------------------------------------------------------------|--------|
| [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat) | <br /> |

-

  ## Interfaces

  - [CancellationSignal.OnCancelListener](https://developer.android.com/reference/android/support/v4/os/CancellationSignal.OnCancelListener)
  - [ParcelableCompatCreatorCallbacks](https://developer.android.com/reference/android/support/v4/os/ParcelableCompatCreatorCallbacks)
-

  ## Classes

  - [BuildCompat](https://developer.android.com/reference/android/support/v4/os/BuildCompat)
  - [CancellationSignal](https://developer.android.com/reference/android/support/v4/os/CancellationSignal)
  - [ConfigurationCompat](https://developer.android.com/reference/android/support/v4/os/ConfigurationCompat)
  - [EnvironmentCompat](https://developer.android.com/reference/android/support/v4/os/EnvironmentCompat)
  - [LocaleListCompat](https://developer.android.com/reference/android/support/v4/os/LocaleListCompat)
  - [ParcelableCompat](https://developer.android.com/reference/android/support/v4/os/ParcelableCompat)
  - [TraceCompat](https://developer.android.com/reference/android/support/v4/os/TraceCompat)
  - [UserManagerCompat](https://developer.android.com/reference/android/support/v4/os/UserManagerCompat)
-

  ## Exceptions

  - [OperationCanceledException](https://developer.android.com/reference/android/support/v4/os/OperationCanceledException)