Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/widget/ArrayAdapter#inhconstants) \| [Ctors](https://developer.android.com/reference/android/widget/ArrayAdapter#pubctors) \| [Methods](https://developer.android.com/reference/android/widget/ArrayAdapter#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/widget/ArrayAdapter#inhmethods)

# ArrayAdapter

*** ** * ** ***

` public class ArrayAdapter `   
` ` ` extends https://developer.android.com/reference/android/widget/BaseAdapter ` ` implements https://developer.android.com/reference/android/widget/Filterable, https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter `

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) |||
| ↳ | [android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter) ||
|   | ↳ | android.widget.ArrayAdapter\<T\> |

<br />

*** ** * ** ***

You can use this adapter to provide views for an `https://developer.android.com/reference/android/widget/AdapterView`, Returns a view for each object in a collection of data objects you provide, and can be used with list-based user interface widgets such as `https://developer.android.com/reference/android/widget/ListView` or `https://developer.android.com/reference/android/widget/Spinner`.

By default, the array adapter creates a view by calling `https://developer.android.com/reference/java/lang/Object#toString()` on each data object in the collection you provide, and places the result in a TextView. You may also customize what type of view is used for the data object in the collection. To customize what type of view is used for the data object, override `https://developer.android.com/reference/android/widget/ArrayAdapter#getView(int,%20android.view.View,%20android.view.ViewGroup)` and inflate a view resource.

For an example of using an array adapter with a ListView, see the [Adapter Views](https://developer.android.com/guide/topics/ui/declaring-layout#AdapterViews) guide.

For an example of using an array adapter with a Spinner, see the [Spinners](https://developer.android.com/guide/topics/ui/controls/spinner) guide.

**Note:** If you are considering using array adapter with a ListView, consider using `https://developer.android.com/reference/androidx/recyclerview/widget/RecyclerView.html` instead. RecyclerView offers similar features with better performance and more flexibility than ListView provides. See the [Recycler View](https://developer.android.com/guide/topics/ui/layout/recyclerview.html) guide.

<br />

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/android/widget/Adapter` `int` `https://developer.android.com/reference/android/widget/Adapter#IGNORE_ITEM_VIEW_TYPE`

An item view type that causes the `https://developer.android.com/reference/android/widget/AdapterView` to ignore the item view.
`int` `https://developer.android.com/reference/android/widget/Adapter#NO_SELECTION`

<br />

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int)(https://developer.android.com/reference/android/content/Context context, int resource) ` Constructor |
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int,%20int)(https://developer.android.com/reference/android/content/Context context, int resource, int textViewResourceId) ` Constructor |
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int,%20int,%20java.util.List<T>)(https://developer.android.com/reference/android/content/Context context, int resource, int textViewResourceId, https://developer.android.com/reference/java/util/List<T> objects) ` Constructor |
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int,%20int,%20T[])(https://developer.android.com/reference/android/content/Context context, int resource, int textViewResourceId, T[] objects) ` Constructor. |
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int,%20java.util.List<T>)(https://developer.android.com/reference/android/content/Context context, int resource, https://developer.android.com/reference/java/util/List<T> objects) ` Constructor |
| ` https://developer.android.com/reference/android/widget/ArrayAdapter#ArrayAdapter(android.content.Context,%20int,%20T[])(https://developer.android.com/reference/android/content/Context context, int resource, T[] objects) ` Constructor. |

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#add(T)(T object) ` Adds the specified object at the end of the array. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(java.util.Collection<?%20extends%20T>)(https://developer.android.com/reference/java/util/Collection<? extends T> collection) ` Adds the specified Collection at the end of the array. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(T[])(T... items) ` Adds the specified items at the end of the array. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#clear()() ` Remove all elements from the list. |
| ` static https://developer.android.com/reference/android/widget/ArrayAdapter<https://developer.android.com/reference/java/lang/CharSequence>` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#createFromResource(android.content.Context,%20int,%20int)(https://developer.android.com/reference/android/content/Context context, int textArrayResId, int textViewResId) ` Creates a new ArrayAdapter from external resources. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getAutofillOptions()() ` Gets a string representation of the adapter data that can help `https://developer.android.com/reference/android/service/autofill/AutofillService` autofill the view backed by the adapter. |
| ` https://developer.android.com/reference/android/content/Context` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getContext()() ` Returns the context associated with this array adapter. |
| ` int` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getCount()() ` How many items are in the data set represented by this Adapter. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) ` Gets a `https://developer.android.com/reference/android/view/View` that displays in the drop down popup the data at the specified position in the data set. |
| ` https://developer.android.com/reference/android/content/res/Resources.Theme` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getDropDownViewTheme()() ` Returns the value previously set by a call to `https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)`. |
| ` https://developer.android.com/reference/android/widget/Filter` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getFilter()() ` <br /> Returns a filter that can be used to constrain data with a filtering pattern. |
| ` T` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getItem(int)(int position) ` Get the data item associated with the specified position in the data set. |
| ` long` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getItemId(int)(int position) ` Get the row id associated with the specified position in the list. |
| ` int` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getPosition(T)(T item) ` Returns the position of the specified item in the array. |
| ` https://developer.android.com/reference/android/view/View` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#getView(int,%20android.view.View,%20android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) ` Get a View that displays the data at the specified position in the data set. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#insert(T,%20int)(T object, int index) ` Inserts the specified object at the specified index in the array. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#notifyDataSetChanged()() ` Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#remove(T)(T object) ` Removes the specified object from the array. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#setDropDownViewResource(int)(int resource) ` <br /> Sets the layout resource to create the drop down views. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)(https://developer.android.com/reference/android/content/res/Resources.Theme theme) ` Sets the `https://developer.android.com/reference/android/content/res/Resources.Theme` against which drop-down views are inflated. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#setNotifyOnChange(boolean)(boolean notifyOnChange) ` Control whether methods that change the list (`https://developer.android.com/reference/android/widget/ArrayAdapter#add(T)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(java.util.Collection<?%20extends%20T>)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(T[])`, `https://developer.android.com/reference/android/widget/ArrayAdapter#insert(T,%20int)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#remove(T)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#clear()`, `https://developer.android.com/reference/android/widget/ArrayAdapter#sort(java.util.Comparator<?%20super%20T>)`) automatically call `https://developer.android.com/reference/android/widget/ArrayAdapter#notifyDataSetChanged()`. |
| ` void` | ` https://developer.android.com/reference/android/widget/ArrayAdapter#sort(java.util.Comparator<?%20super%20T>)(https://developer.android.com/reference/java/util/Comparator<? super T> comparator) ` Sorts the content of this adapter using the specified comparator. |

### Inherited methods

From class ` https://developer.android.com/reference/android/widget/BaseAdapter ` ` boolean` ` https://developer.android.com/reference/android/widget/BaseAdapter#areAllItemsEnabled()() `

Indicates whether all the items in this adapter are enabled.
` https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/widget/BaseAdapter#getAutofillOptions()() `

Gets a string representation of the adapter data that can help `https://developer.android.com/reference/android/service/autofill/AutofillService` autofill the view backed by the adapter.
` https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/widget/BaseAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) `

Gets a `https://developer.android.com/reference/android/view/View` that displays in the drop down popup the data at the specified position in the data set.
` int` ` https://developer.android.com/reference/android/widget/BaseAdapter#getItemViewType(int)(int position) `

Get the type of View that will be created by `https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)` for the specified item.
` int` ` https://developer.android.com/reference/android/widget/BaseAdapter#getViewTypeCount()() `

<br />

Returns the number of types of Views that will be created by `https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)`.
` boolean` ` https://developer.android.com/reference/android/widget/BaseAdapter#hasStableIds()() `

Indicates whether the item ids are stable across changes to the underlying data.
` boolean` ` https://developer.android.com/reference/android/widget/BaseAdapter#isEmpty()() `

<br />

` boolean` ` https://developer.android.com/reference/android/widget/BaseAdapter#isEnabled(int)(int position) `

Returns true if the item at the specified position is not a separator.
` void` ` https://developer.android.com/reference/android/widget/BaseAdapter#notifyDataSetChanged()() `

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.
` void` ` https://developer.android.com/reference/android/widget/BaseAdapter#notifyDataSetInvalidated()() `

Notifies the attached observers that the underlying data is no longer valid or available.
` void` ` https://developer.android.com/reference/android/widget/BaseAdapter#registerDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) `

Register an observer that is called when changes happen to the data used by this adapter.
` void` ` https://developer.android.com/reference/android/widget/BaseAdapter#setAutofillOptions(java.lang.CharSequence[])(https://developer.android.com/reference/java/lang/CharSequence options) `

Sets the value returned by `https://developer.android.com/reference/android/widget/BaseAdapter#getAutofillOptions()`
` void` ` https://developer.android.com/reference/android/widget/BaseAdapter#unregisterDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) `

Unregister an observer that has previously been registered with this adapter via `https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)`.
From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/widget/ListAdapter ` ` abstract boolean` ` https://developer.android.com/reference/android/widget/ListAdapter#areAllItemsEnabled()() `

Indicates whether all the items in this adapter are enabled.
` abstract boolean` ` https://developer.android.com/reference/android/widget/ListAdapter#isEnabled(int)(int position) `

Returns true if the item at the specified position is not a separator.
From interface ` https://developer.android.com/reference/android/widget/SpinnerAdapter ` ` abstract https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/widget/SpinnerAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) `

Gets a `https://developer.android.com/reference/android/view/View` that displays in the drop down popup the data at the specified position in the data set.
From interface ` https://developer.android.com/reference/android/widget/Filterable ` ` abstract https://developer.android.com/reference/android/widget/Filter` ` https://developer.android.com/reference/android/widget/Filterable#getFilter()() `

<br />

Returns a filter that can be used to constrain data with a filtering pattern.
From interface ` https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter ` ` abstract https://developer.android.com/reference/android/content/res/Resources.Theme` ` https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#getDropDownViewTheme()() `

Returns the value previously set by a call to `https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)`.
` abstract void` ` https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)(https://developer.android.com/reference/android/content/res/Resources.Theme theme) `

Sets the `https://developer.android.com/reference/android/content/res/Resources.Theme` against which drop-down views are inflated.
From interface ` https://developer.android.com/reference/android/widget/Adapter ` ` default https://developer.android.com/reference/java/lang/CharSequence` ` https://developer.android.com/reference/android/widget/Adapter#getAutofillOptions()() `

Gets a string representation of the adapter data that can help `https://developer.android.com/reference/android/service/autofill/AutofillService` autofill the view backed by the adapter.
` abstract int` ` https://developer.android.com/reference/android/widget/Adapter#getCount()() `

How many items are in the data set represented by this Adapter.
` abstract https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/android/widget/Adapter#getItem(int)(int position) `

Get the data item associated with the specified position in the data set.
` abstract long` ` https://developer.android.com/reference/android/widget/Adapter#getItemId(int)(int position) `

Get the row id associated with the specified position in the list.
` abstract int` ` https://developer.android.com/reference/android/widget/Adapter#getItemViewType(int)(int position) `

Get the type of View that will be created by `https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)` for the specified item.
` abstract https://developer.android.com/reference/android/view/View` ` https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View convertView, https://developer.android.com/reference/android/view/ViewGroup parent) `

Get a View that displays the data at the specified position in the data set.
` abstract int` ` https://developer.android.com/reference/android/widget/Adapter#getViewTypeCount()() `

<br />

Returns the number of types of Views that will be created by `https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)`.
` abstract boolean` ` https://developer.android.com/reference/android/widget/Adapter#hasStableIds()() `

Indicates whether the item ids are stable across changes to the underlying data.
` abstract boolean` ` https://developer.android.com/reference/android/widget/Adapter#isEmpty()() ` ` abstract void` ` https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) `

Register an observer that is called when changes happen to the data used by this adapter.
` abstract void` ` https://developer.android.com/reference/android/widget/Adapter#unregisterDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver observer) `

Unregister an observer that has previously been registered with this adapter via `https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)`.

## Public constructors

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource)
```

Constructor

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a TextView to use when instantiating views. <br /> |

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource, 
                int textViewResourceId)
```

Constructor

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a layout to use when instantiating views. <br /> |
| `textViewResourceId` | `int`: The id of the TextView within the layout resource to be populated <br /> |

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource, 
                int textViewResourceId, 
                List<T> objects)
```

Constructor

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a layout to use when instantiating views. <br /> |
| `textViewResourceId` | `int`: The id of the TextView within the layout resource to be populated <br /> |
| `objects` | `List`: The objects to represent in the ListView. This value cannot be `null`. <br /> |

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource, 
                int textViewResourceId, 
                T[] objects)
```

Constructor. This constructor will result in the underlying data collection being immutable, so methods such as `https://developer.android.com/reference/android/widget/ArrayAdapter#clear()` will throw an exception.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a layout to use when instantiating views. <br /> |
| `textViewResourceId` | `int`: The id of the TextView within the layout resource to be populated <br /> |
| `objects` | `T`: The objects to represent in the ListView. This value cannot be `null`. <br /> |

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource, 
                List<T> objects)
```

Constructor

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a TextView to use when instantiating views. <br /> |
| `objects` | `List`: The objects to represent in the ListView. This value cannot be `null`. <br /> |

### ArrayAdapter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public ArrayAdapter (Context context, 
                int resource, 
                T[] objects)
```

Constructor. This constructor will result in the underlying data collection being immutable, so methods such as `https://developer.android.com/reference/android/widget/ArrayAdapter#clear()` will throw an exception.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The current context. This value cannot be `null`. <br /> |
| `resource` | `int`: The resource ID for a layout file containing a TextView to use when instantiating views. <br /> |
| `objects` | `T`: The objects to represent in the ListView. This value cannot be `null`. <br /> |

## Public methods

### add

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void add (T object)
```

Adds the specified object at the end of the array.

<br />

| Parameters ||
|---|---|
| `object` | `T`: The object to add at the end of the array. This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the underlying data collection is immutable |

### addAll

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addAll (Collection<? extends T> collection)
```

Adds the specified Collection at the end of the array.

<br />

| Parameters ||
|---|---|
| `collection` | `Collection`: The Collection to add at the end of the array. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/ClassCastException` | if the class of an element of the specified collection prevents it from being added to this list |
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if some property of an element of the specified collection prevents it from being added to this list |
| `https://developer.android.com/reference/java/lang/NullPointerException` | if the specified collection contains one or more null elements and this list does not permit null elements, or if the specified collection is null |
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the addAll operation is not supported by this list |

### addAll

Added in [API level 11](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void addAll (T... items)
```

Adds the specified items at the end of the array.

<br />

| Parameters ||
|---|---|
| `items` | `T`: The items to add at the end of the array. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the underlying data collection is immutable |

### clear

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void clear ()
```

Remove all elements from the list.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the underlying data collection is immutable |

### createFromResource

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static ArrayAdapter<CharSequence> createFromResource (Context context, 
                int textArrayResId, 
                int textViewResId)
```

Creates a new ArrayAdapter from external resources. The content of the array is obtained through `https://developer.android.com/reference/android/content/res/Resources#getTextArray(int)`.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: The application's environment. This value cannot be `null`. <br /> |
| `textArrayResId` | `int`: The identifier of the array to use as the data source. <br /> |
| `textViewResId` | `int`: The identifier of the layout used to create views. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/widget/ArrayAdapter<https://developer.android.com/reference/java/lang/CharSequence>` | An ArrayAdapter . This value cannot be `null`. <br /> |

### getAutofillOptions

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence[] getAutofillOptions ()
```

Gets a string representation of the adapter data that can help `https://developer.android.com/reference/android/service/autofill/AutofillService` autofill the view backed by the adapter.

It should only be set (i.e., non-`null` if the values do not represent PII (Personally Identifiable Information - sensitive data such as email addresses, credit card numbers, passwords, etc...). For example, it's ok to return a list of month names, but not a list of usernames. A good rule of thumb is that if the adapter data comes from static resources, such data is not PII - see `https://developer.android.com/reference/android/view/ViewStructure#setDataIsSensitive(boolean)` for more info.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | values from the string array used by `https://developer.android.com/reference/android/widget/ArrayAdapter#createFromResource(android.content.Context,%20int,%20int)`, or `null` if object was created otherwsie or if contents were dynamically changed after creation. <br /> |

### getContext

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Context getContext ()
```

Returns the context associated with this array adapter. The context is used to create views from the resource passed to the constructor.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Context` | The Context associated with this adapter. This value cannot be `null`. <br /> |

### getCount

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getCount ()
```

How many items are in the data set represented by this Adapter.

<br />

| Returns ||
|---|---|
| `int` | Count of items. <br /> |

### getDropDownView

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public View getDropDownView (int position, 
                View convertView, 
                ViewGroup parent)
```

Gets a `https://developer.android.com/reference/android/view/View` that displays in the drop down popup the data at the specified position in the data set.

<br />

| Parameters ||
|---|---|
| `position` | `int`: index of the item whose view we want. <br /> |
| `convertView` | `View`: This value may be `null`. <br /> |
| `parent` | `ViewGroup`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | a `https://developer.android.com/reference/android/view/View` corresponding to the data at the specified position. <br /> |

### getDropDownViewTheme

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Resources.Theme getDropDownViewTheme ()
```

Returns the value previously set by a call to `https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/res/Resources.Theme` | This value may be `null`. <br /> |

### getFilter

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Filter getFilter ()
```

<br />

Returns a filter that can be used to constrain data with a filtering pattern.

This method is usually implemented by `https://developer.android.com/reference/android/widget/Adapter` classes.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/widget/Filter` | This value cannot be `null`. <br /> |

### getItem

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public T getItem (int position)
```

Get the data item associated with the specified position in the data set.

<br />

| Parameters ||
|---|---|
| `position` | `int`: Position of the item whose data we want within the adapter's data set. <br /> |

| Returns ||
|---|---|
| `T` | This value may be `null`. <br /> |

### getItemId

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getItemId (int position)
```

Get the row id associated with the specified position in the list.

<br />

| Parameters ||
|---|---|
| `position` | `int`: The position of the item within the adapter's data set whose row id we want. <br /> |

| Returns ||
|---|---|
| `long` | The id of the item at the specified position. <br /> |

### getPosition

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPosition (T item)
```

Returns the position of the specified item in the array.

<br />

| Parameters ||
|---|---|
| `item` | `T`: The item to retrieve the position of. This value may be `null`. <br /> |

| Returns ||
|---|---|
| `int` | The position of the specified item. <br /> |

### getView

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public View getView (int position, 
                View convertView, 
                ViewGroup parent)
```

Get a View that displays the data at the specified position in the data set. You can either create a View manually or inflate it from an XML layout file. When the View is inflated, the parent View (GridView, ListView...) will apply default layout parameters unless you use `https://developer.android.com/reference/android/view/LayoutInflater#inflate(int,%20android.view.ViewGroup,%20boolean)` to specify a root view and to prevent attachment to the root.

<br />

| Parameters ||
|---|---|
| `position` | `int`: The position of the item within the adapter's data set of the item whose view we want. <br /> |
| `convertView` | `View`: This value may be `null`. <br /> |
| `parent` | `ViewGroup`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/View` | This value cannot be `null`. <br /> |

### insert

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void insert (T object, 
                int index)
```

Inserts the specified object at the specified index in the array.

<br />

| Parameters ||
|---|---|
| `object` | `T`: The object to insert into the array. This value may be `null`. <br /> |
| `index` | `int`: The index at which the object must be inserted. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the underlying data collection is immutable |

### notifyDataSetChanged

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void notifyDataSetChanged ()
```

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

<br />

### remove

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void remove (T object)
```

Removes the specified object from the array.

<br />

| Parameters ||
|---|---|
| `object` | `T`: The object to remove. This value may be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/UnsupportedOperationException` | if the underlying data collection is immutable |

### setDropDownViewResource

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setDropDownViewResource (int resource)
```

<br />

Sets the layout resource to create the drop down views.

<br />

<br />

| Parameters ||
|---|---|
| `resource` | `int`: the layout resource defining the drop down views <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ArrayAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup)`

### setDropDownViewTheme

Added in [API level 23](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setDropDownViewTheme (Resources.Theme theme)
```

Sets the `https://developer.android.com/reference/android/content/res/Resources.Theme` against which drop-down views are inflated.

By default, drop-down views are inflated against the theme of the `https://developer.android.com/reference/android/content/Context` passed to the adapter's constructor.

<br />

| Parameters ||
|---|---|
| `theme` | `Resources.Theme`: the theme against which to inflate drop-down views or `null` to use the theme from the adapter's context <br /> |

**See also:**

- `https://developer.android.com/reference/android/widget/ArrayAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup)`

### setNotifyOnChange

Added in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void setNotifyOnChange (boolean notifyOnChange)
```

Control whether methods that change the list (`https://developer.android.com/reference/android/widget/ArrayAdapter#add(T)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(java.util.Collection<?%20extends%20T>)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#addAll(T[])`, `https://developer.android.com/reference/android/widget/ArrayAdapter#insert(T,%20int)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#remove(T)`, `https://developer.android.com/reference/android/widget/ArrayAdapter#clear()`, `https://developer.android.com/reference/android/widget/ArrayAdapter#sort(java.util.Comparator<?%20super%20T>)`) automatically call `https://developer.android.com/reference/android/widget/ArrayAdapter#notifyDataSetChanged()`. If set to false, caller must manually call notifyDataSetChanged() to have the changes reflected in the attached view. The default is true, and calling notifyDataSetChanged() resets the flag to true.

<br />

| Parameters ||
|---|---|
| `notifyOnChange` | `boolean`: if true, modifications to the list will automatically call `https://developer.android.com/reference/android/widget/ArrayAdapter#notifyDataSetChanged()` <br /> |

### sort

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void sort (Comparator<? super T> comparator)
```

Sorts the content of this adapter using the specified comparator.

<br />

| Parameters ||
|---|---|
| `comparator` | `Comparator`: The comparator used to sort the objects contained in this adapter. This value cannot be `null`. <br /> |