# CursorAdapter

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

# CursorAdapter

*** ** * ** ***

[Kotlin](https://developer.android.com/reference/kotlin/android/widget/CursorAdapter "View this page in Kotlin")\|Java

`
public


abstract
class
CursorAdapter
`  
`


``

extends `[BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter)`


``


implements

`[Filterable](https://developer.android.com/reference/android/widget/Filterable)`,

`[ThemedSpinnerAdapter](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.CursorAdapter |

|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known direct subclasses [ResourceCursorAdapter](https://developer.android.com/reference/android/widget/ResourceCursorAdapter) |-------------------------------------------------------------------------------------------------------|------------------------------------------------------------| | [ResourceCursorAdapter](https://developer.android.com/reference/android/widget/ResourceCursorAdapter) | An easy adapter that creates views defined in an XML file. | |

|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Known indirect subclasses [SimpleCursorAdapter](https://developer.android.com/reference/android/widget/SimpleCursorAdapter) |---------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------| | [SimpleCursorAdapter](https://developer.android.com/reference/android/widget/SimpleCursorAdapter) | An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. | |

<br />

*** ** * ** ***

Adapter that exposes data from a[Cursor](https://developer.android.com/reference/android/database/Cursor)to a[ListView](https://developer.android.com/reference/android/widget/ListView)widget.

The Cursor must include a column named "_id" or this class will not work. Additionally, using[MergeCursor](https://developer.android.com/reference/android/database/MergeCursor)with this class will not work if the merged Cursors have overlapping values in their "_id" columns.

## Summary

|                                                                                                                                                                                                                                                                            ### Constants                                                                                                                                                                                                                                                                            ||
|-------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `int` | [FLAG_AUTO_REQUERY](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_AUTO_REQUERY) *This constant was deprecated in API level 15. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use[LoaderManager](https://developer.android.com/reference/android/app/LoaderManager)with a[CursorLoader](https://developer.android.com/reference/android/content/CursorLoader).* |
| `int` | [FLAG_REGISTER_CONTENT_OBSERVER](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER) If set the adapter will register a content observer on the cursor and will call[onContentChanged()](https://developer.android.com/reference/android/widget/CursorAdapter#onContentChanged())when a notification comes in.                                                                                                                                                                                              |

|                                                                                                                                                                                                                                                                                                                                                                                                                                                ### Inherited constants                                                                                                                                                                                                                                                                                                                                                                                                                                                |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| From interface[android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter) |-------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `int` | [IGNORE_ITEM_VIEW_TYPE](https://developer.android.com/reference/android/widget/Adapter#IGNORE_ITEM_VIEW_TYPE) An item view type that causes the[AdapterView](https://developer.android.com/reference/android/widget/AdapterView)to ignore the item view. | | `int` | [NO_SELECTION](https://developer.android.com/reference/android/widget/Adapter#NO_SELECTION) <br />                                                                                                                                                       | |

|                                                                                                                                                                                                                                                                                                                                                                         ### Public constructors                                                                                                                                                                                                                                                                                                                                                                          ||
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---|
| ` `[CursorAdapter](https://developer.android.com/reference/android/widget/CursorAdapter#CursorAdapter(android.content.Context,%20android.database.Cursor))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` c) ` *This constructor is deprecated. This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use[LoaderManager](https://developer.android.com/reference/android/app/LoaderManager)with a[CursorLoader](https://developer.android.com/reference/android/content/CursorLoader).* |
| ` `[CursorAdapter](https://developer.android.com/reference/android/widget/CursorAdapter#CursorAdapter(android.content.Context,%20android.database.Cursor,%20boolean))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` c, boolean autoRequery) ` Constructor that allows control over auto-requery.                                                                                                                                                                                                                                                                                                                                                 |
| ` `[CursorAdapter](https://developer.android.com/reference/android/widget/CursorAdapter#CursorAdapter(android.content.Context,%20android.database.Cursor,%20int))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` c, int flags) ` Recommended constructor.                                                                                                                                                                                                                                                                                                                                                                                         |

|                                                                                                                                                                                                                                                                                                         ### Public methods                                                                                                                                                                                                                                                                                                          ||
|------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` abstract void`                                                                                     | ` `[bindView](https://developer.android.com/reference/android/widget/CursorAdapter#bindView(android.view.View,%20android.content.Context,%20android.database.Cursor))`(`[View](https://developer.android.com/reference/android/view/View)` view, `[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` cursor) ` Bind an existing view to the data pointed to by cursor                                           |
| ` void`                                                                                              | ` `[changeCursor](https://developer.android.com/reference/android/widget/CursorAdapter#changeCursor(android.database.Cursor))`(`[Cursor](https://developer.android.com/reference/android/database/Cursor)` cursor) ` Change the underlying cursor to a new cursor.                                                                                                                                                                                                                                                            |
| ` `[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)                    | ` `[convertToString](https://developer.android.com/reference/android/widget/CursorAdapter#convertToString(android.database.Cursor))`(`[Cursor](https://developer.android.com/reference/android/database/Cursor)` cursor) ` <br /> Converts the cursor into a CharSequence.                                                                                                                                                                                                                                                    |
| ` int`                                                                                               | ` `[getCount](https://developer.android.com/reference/android/widget/CursorAdapter#getCount())`() ` How many items are in the data set represented by this Adapter.                                                                                                                                                                                                                                                                                                                                                           |
| ` `[Cursor](https://developer.android.com/reference/android/database/Cursor)                         | ` `[getCursor](https://developer.android.com/reference/android/widget/CursorAdapter#getCursor())`() ` Returns the cursor.                                                                                                                                                                                                                                                                                                                                                                                                     |
| ` `[View](https://developer.android.com/reference/android/view/View)                                 | ` `[getDropDownView](https://developer.android.com/reference/android/widget/CursorAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup))`(int position, `[View](https://developer.android.com/reference/android/view/View)` convertView, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Gets a[View](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.        |
| ` `[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)    | ` `[getDropDownViewTheme](https://developer.android.com/reference/android/widget/CursorAdapter#getDropDownViewTheme())`() ` Returns the value previously set by a call to[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)).                                                                                                                                                  |
| ` `[Filter](https://developer.android.com/reference/android/widget/Filter)                           | ` `[getFilter](https://developer.android.com/reference/android/widget/CursorAdapter#getFilter())`() ` <br /> Returns a filter that can be used to constrain data with a filtering pattern.                                                                                                                                                                                                                                                                                                                                    |
| ` `[FilterQueryProvider](https://developer.android.com/reference/android/widget/FilterQueryProvider) | ` `[getFilterQueryProvider](https://developer.android.com/reference/android/widget/CursorAdapter#getFilterQueryProvider())`() ` Returns the query filter provider used for filtering.                                                                                                                                                                                                                                                                                                                                         |
| ` `[Object](https://developer.android.com/reference/java/lang/Object)                                | ` `[getItem](https://developer.android.com/reference/android/widget/CursorAdapter#getItem(int))`(int position) ` Get the data item associated with the specified position in the data set.                                                                                                                                                                                                                                                                                                                                    |
| ` long`                                                                                              | ` `[getItemId](https://developer.android.com/reference/android/widget/CursorAdapter#getItemId(int))`(int position) ` Get the row id associated with the specified position in the list.                                                                                                                                                                                                                                                                                                                                       |
| ` `[View](https://developer.android.com/reference/android/view/View)                                 | ` `[getView](https://developer.android.com/reference/android/widget/CursorAdapter#getView(int,%20android.view.View,%20android.view.ViewGroup))`(int position, `[View](https://developer.android.com/reference/android/view/View)` convertView, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Get a View that displays the data at the specified position in the data set.                                                                                                           |
| ` boolean`                                                                                           | ` `[hasStableIds](https://developer.android.com/reference/android/widget/CursorAdapter#hasStableIds())`() ` Indicates whether the item ids are stable across changes to the underlying data.                                                                                                                                                                                                                                                                                                                                  |
| ` `[View](https://developer.android.com/reference/android/view/View)                                 | ` `[newDropDownView](https://developer.android.com/reference/android/widget/CursorAdapter#newDropDownView(android.content.Context,%20android.database.Cursor,%20android.view.ViewGroup))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` cursor, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Makes a new drop down view to hold the data pointed to by cursor. |
| ` abstract `[View](https://developer.android.com/reference/android/view/View)                        | ` `[newView](https://developer.android.com/reference/android/widget/CursorAdapter#newView(android.content.Context,%20android.database.Cursor,%20android.view.ViewGroup))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` cursor, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Makes a new view to hold the data pointed to by cursor.                           |
| ` `[Cursor](https://developer.android.com/reference/android/database/Cursor)                         | ` `[runQueryOnBackgroundThread](https://developer.android.com/reference/android/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence))`(`[CharSequence](https://developer.android.com/reference/java/lang/CharSequence)` constraint) ` Runs a query with the specified constraint.                                                                                                                                                                                                                          |
| ` void`                                                                                              | ` `[setDropDownViewTheme](https://developer.android.com/reference/android/widget/CursorAdapter#setDropDownViewTheme(android.content.res.Resources.Theme))`(`[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)` theme) ` Sets the[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)against which drop-down views are inflated.                                                                                                        |
| ` void`                                                                                              | ` `[setFilterQueryProvider](https://developer.android.com/reference/android/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider))`(`[FilterQueryProvider](https://developer.android.com/reference/android/widget/FilterQueryProvider)` filterQueryProvider) ` Sets the query filter provider used to filter the current Cursor.                                                                                                                                                                    |
| ` `[Cursor](https://developer.android.com/reference/android/database/Cursor)                         | ` `[swapCursor](https://developer.android.com/reference/android/widget/CursorAdapter#swapCursor(android.database.Cursor))`(`[Cursor](https://developer.android.com/reference/android/database/Cursor)` newCursor) ` Swap in a new Cursor, returning the old Cursor.                                                                                                                                                                                                                                                           |

|                                                                                                                                                                                                                                  ### Protected methods                                                                                                                                                                                                                                  ||
|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[init](https://developer.android.com/reference/android/widget/CursorAdapter#init(android.content.Context,%20android.database.Cursor,%20boolean))`(`[Context](https://developer.android.com/reference/android/content/Context)` context, `[Cursor](https://developer.android.com/reference/android/database/Cursor)` c, boolean autoRequery) ` *This method was deprecated in API level 15. Don't use this, use the normal constructor. This will be removed in the future.* |
| ` void` | ` `[onContentChanged](https://developer.android.com/reference/android/widget/CursorAdapter#onContentChanged())`() ` Called when the[ContentObserver](https://developer.android.com/reference/android/database/ContentObserver)on the cursor receives a change notification.                                                                                                                                                                                                    |

| ### Inherited methods |
|-----------------------|---|
| From class` `[android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter)` ` |-------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` boolean`                                                                          | ` `[areAllItemsEnabled](https://developer.android.com/reference/android/widget/BaseAdapter#areAllItemsEnabled())`() ` Indicates whether all the items in this adapter are enabled.                                                                                                                                                                                                                                                                                                                                              | | ` `[CharSequence[]](https://developer.android.com/reference/java/lang/CharSequence) | ` `[getAutofillOptions](https://developer.android.com/reference/android/widget/BaseAdapter#getAutofillOptions())`() ` Gets a string representation of the adapter data that can help[AutofillService](https://developer.android.com/reference/android/service/autofill/AutofillService)autofill the view backed by the adapter.                                                                                                                                                                                                 | | ` `[View](https://developer.android.com/reference/android/view/View)                | ` `[getDropDownView](https://developer.android.com/reference/android/widget/BaseAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup))`(int position, `[View](https://developer.android.com/reference/android/view/View)` convertView, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Gets a[View](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`                                                                              | ` `[getItemViewType](https://developer.android.com/reference/android/widget/BaseAdapter#getItemViewType(int))`(int position) ` Get the type of View that will be created by[getView(int, View, ViewGroup)](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup))for the specified item.                                                                                                                                                                   | | ` int`                                                                              | ` `[getViewTypeCount](https://developer.android.com/reference/android/widget/BaseAdapter#getViewTypeCount())`() ` <br /> Returns the number of types of Views that will be created by[getView(int, View, ViewGroup)](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)).                                                                                                                                                                               | | ` boolean`                                                                          | ` `[hasStableIds](https://developer.android.com/reference/android/widget/BaseAdapter#hasStableIds())`() ` Indicates whether the item ids are stable across changes to the underlying data.                                                                                                                                                                                                                                                                                                                                      | | ` boolean`                                                                          | ` `[isEmpty](https://developer.android.com/reference/android/widget/BaseAdapter#isEmpty())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` boolean`                                                                          | ` `[isEnabled](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`                                                                             | ` `[notifyDataSetChanged](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`                                                                             | ` `[notifyDataSetInvalidated](https://developer.android.com/reference/android/widget/BaseAdapter#notifyDataSetInvalidated())`() ` Notifies the attached observers that the underlying data is no longer valid or available.                                                                                                                                                                                                                                                                                                     | | ` void`                                                                             | ` `[registerDataSetObserver](https://developer.android.com/reference/android/widget/BaseAdapter#registerDataSetObserver(android.database.DataSetObserver))`(`[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`                                                                             | ` `[setAutofillOptions](https://developer.android.com/reference/android/widget/BaseAdapter#setAutofillOptions(java.lang.CharSequence[]))`(`[CharSequence...](https://developer.android.com/reference/java/lang/CharSequence)` options) ` Sets the value returned by[getAutofillOptions()](https://developer.android.com/reference/android/widget/BaseAdapter#getAutofillOptions())                                                                                                                                              | | ` void`                                                                             | ` `[unregisterDataSetObserver](https://developer.android.com/reference/android/widget/BaseAdapter#unregisterDataSetObserver(android.database.DataSetObserver))`(`[DataSetObserver](https://developer.android.com/reference/android/database/DataSetObserver)` observer) ` Unregister an observer that has previously been registered with this adapter via[registerDataSetObserver(DataSetObserver)](https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)). | ||
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](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 `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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`                                                                  | ` `[wait](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` `[android.widget.ListAdapter](https://developer.android.com/reference/android/widget/ListAdapter)` ` |---------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract boolean` | ` `[areAllItemsEnabled](https://developer.android.com/reference/android/widget/ListAdapter#areAllItemsEnabled())`() ` Indicates whether all the items in this adapter are enabled.        | | ` abstract boolean` | ` `[isEnabled](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` `[android.widget.SpinnerAdapter](https://developer.android.com/reference/android/widget/SpinnerAdapter)` ` |-------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[View](https://developer.android.com/reference/android/view/View) | ` `[getDropDownView](https://developer.android.com/reference/android/widget/SpinnerAdapter#getDropDownView(int,%20android.view.View,%20android.view.ViewGroup))`(int position, `[View](https://developer.android.com/reference/android/view/View)` convertView, `[ViewGroup](https://developer.android.com/reference/android/view/ViewGroup)` parent) ` Gets a[View](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` `[android.widget.Filterable](https://developer.android.com/reference/android/widget/Filterable)` ` |-------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Filter](https://developer.android.com/reference/android/widget/Filter) | ` `[getFilter](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` `[android.widget.ThemedSpinnerAdapter](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter)` ` |------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` abstract `[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme) | ` `[getDropDownViewTheme](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#getDropDownViewTheme())`() ` Returns the value previously set by a call to[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)).                                           | | ` abstract void`                                                                                           | ` `[setDropDownViewTheme](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme))`(`[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)` theme) ` Sets the[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)against which drop-down views are inflated. | ||
| From interface` `[android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter)` ` |---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` default `[CharSequence[]](https://developer.android.com/reference/java/lang/CharSequence) | ` `[getAutofillOptions](https://developer.android.com/reference/android/widget/Adapter#getAutofillOptions())`() ` Gets a string representation of the adapter data that can help[AutofillService](https://developer.android.com/reference/android/service/autofill/AutofillService)autofill the view backed by the adapter.                                                                                                                                                                                                 | | ` abstract int`                                                                             | ` `[getCount](https://developer.android.com/reference/android/widget/Adapter#getCount())`() ` How many items are in the data set represented by this Adapter.                                                                                                                                                                                                                                                                                                                                                               | | ` abstract `[Object](https://developer.android.com/reference/java/lang/Object)              | ` `[getItem](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`                                                                            | ` `[getItemId](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`                                                                             | ` `[getItemViewType](https://developer.android.com/reference/android/widget/Adapter#getItemViewType(int))`(int position) ` Get the type of View that will be created by[getView(int, View, ViewGroup)](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup))for the specified item.                                                                                                                                                                   | | ` abstract `[View](https://developer.android.com/reference/android/view/View)               | ` `[getView](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup))`(int position, `[View](https://developer.android.com/reference/android/view/View)` convertView, `[ViewGroup](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`                                                                             | ` `[getViewTypeCount](https://developer.android.com/reference/android/widget/Adapter#getViewTypeCount())`() ` <br /> Returns the number of types of Views that will be created by[getView(int, View, ViewGroup)](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup)).                                                                                                                                                                               | | ` abstract boolean`                                                                         | ` `[hasStableIds](https://developer.android.com/reference/android/widget/Adapter#hasStableIds())`() ` Indicates whether the item ids are stable across changes to the underlying data.                                                                                                                                                                                                                                                                                                                                      | | ` abstract boolean`                                                                         | ` `[isEmpty](https://developer.android.com/reference/android/widget/Adapter#isEmpty())`() `                                                                                                                                                                                                                                                                                                                                                                                                                                 | | ` abstract void`                                                                            | ` `[registerDataSetObserver](https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver))`(`[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`                                                                            | ` `[unregisterDataSetObserver](https://developer.android.com/reference/android/widget/Adapter#unregisterDataSetObserver(android.database.DataSetObserver))`(`[DataSetObserver](https://developer.android.com/reference/android/database/DataSetObserver)` observer) ` Unregister an observer that has previously been registered with this adapter via[registerDataSetObserver(DataSetObserver)](https://developer.android.com/reference/android/widget/Adapter#registerDataSetObserver(android.database.DataSetObserver)). | ||

## Constants

### FLAG_AUTO_REQUERY

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

```
public static final int FLAG_AUTO_REQUERY
```

<br />

**This constant was deprecated in API level 15.**   
This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use[LoaderManager](https://developer.android.com/reference/android/app/LoaderManager)with a[CursorLoader](https://developer.android.com/reference/android/content/CursorLoader).

If set the adapter will call requery() on the cursor whenever a content change notification is delivered. Implies[FLAG_REGISTER_CONTENT_OBSERVER](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER).

<br />

Constant Value: 1 (0x00000001)  

### FLAG_REGISTER_CONTENT_OBSERVER

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

```
public static final int FLAG_REGISTER_CONTENT_OBSERVER
```

If set the adapter will register a content observer on the cursor and will call[onContentChanged()](https://developer.android.com/reference/android/widget/CursorAdapter#onContentChanged())when a notification comes in. Be careful when using this flag: you will need to unset the current Cursor from the adapter to avoid leaks due to its registered observers. This flag is not needed when using a CursorAdapter with a[CursorLoader](https://developer.android.com/reference/android/content/CursorLoader).

<br />

Constant Value: 2 (0x00000002)

## Public constructors

### CursorAdapter

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

```
public CursorAdapter (Context context, 
                Cursor c)
```

<br />

**This constructor is deprecated.**   
This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use[LoaderManager](https://developer.android.com/reference/android/app/LoaderManager)with a[CursorLoader](https://developer.android.com/reference/android/content/CursorLoader).

Constructor that always enables auto-requery.

<br />

|                             Parameters                             ||
|-----------|---------------------------------------------------------|
| `context` | `Context`: The context <br />                           |
| `c`       | `Cursor`: The cursor from which to get the data. <br /> |

### CursorAdapter

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

```
public CursorAdapter (Context context, 
                Cursor c, 
                boolean autoRequery)
```

Constructor that allows control over auto-requery. It is recommended you not use this, but instead[CursorAdapter(android.content.Context, android.database.Cursor, int)](https://developer.android.com/reference/android/widget/CursorAdapter#CursorAdapter(android.content.Context,%20android.database.Cursor,%20int)). When using this constructor,[FLAG_REGISTER_CONTENT_OBSERVER](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER)will always be set.

<br />

|                                                                                       Parameters                                                                                        ||
|---------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context`     | `Context`: The context <br />                                                                                                                                            |
| `c`           | `Cursor`: The cursor from which to get the data. <br />                                                                                                                  |
| `autoRequery` | `boolean`: If true the adapter will call requery() on the cursor whenever it changes so the most recent data is always displayed. Using true here is discouraged. <br /> |

### CursorAdapter

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

```
public CursorAdapter (Context context, 
                Cursor c, 
                int flags)
```

Recommended constructor.

<br />

|                                                                                                                                                                         Parameters                                                                                                                                                                          ||
|-----------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: The context <br />                                                                                                                                                                                                                                                                                                                    |
| `c`       | `Cursor`: The cursor from which to get the data. <br />                                                                                                                                                                                                                                                                                          |
| `flags`   | `int`: Flags used to determine the behavior of the adapter; may be any combination of[FLAG_AUTO_REQUERY](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_AUTO_REQUERY)and[FLAG_REGISTER_CONTENT_OBSERVER](https://developer.android.com/reference/android/widget/CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER). <br /> |

## Public methods

### bindView

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

```
public abstract void bindView (View view, 
                Context context, 
                Cursor cursor)
```

Bind an existing view to the data pointed to by cursor

<br />

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `view`    | `View`: Existing view, returned earlier by newView <br />                                                    |
| `context` | `Context`: Interface to application's global information <br />                                              |
| `cursor`  | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |

### changeCursor

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

```
public void changeCursor (Cursor cursor)
```

Change the underlying cursor to a new cursor. If there is an existing cursor it will be closed.

<br />

|                      Parameters                      ||
|----------|--------------------------------------------|
| `cursor` | `Cursor`: The new cursor to be used <br /> |

### convertToString

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

```
public CharSequence convertToString (Cursor cursor)
```

<br />

Converts the cursor into a CharSequence. Subclasses should override this method to convert their results. The default implementation returns an empty String for null values or the default String representation of the value.

<br />

<br />

|                             Parameters                             ||
|----------|----------------------------------------------------------|
| `cursor` | `Cursor`: the cursor to convert to a CharSequence <br /> |

|                                                           Returns                                                            ||
|--------------------------------------------------------------------------------|----------------------------------------------|
| [CharSequence](https://developer.android.com/reference/java/lang/CharSequence) | a CharSequence representing the value <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 /> |

**See also:**

- [Adapter.getCount()](https://developer.android.com/reference/android/widget/Adapter#getCount())  

### getCursor

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

```
public Cursor getCursor ()
```

Returns the cursor.

<br />

|                                            Returns                                            ||
|---------------------------------------------------------------------------|--------------------|
| [Cursor](https://developer.android.com/reference/android/database/Cursor) | the cursor. <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[View](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`: the old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. <br /> |
| `parent`      | `ViewGroup`: the parent that this view will eventually be attached to <br />                                                                                                                                                                             |

|                                                                                             Returns                                                                                              ||
|-------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View) | a[View](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[setDropDownViewTheme(android.content.res.Resources.Theme)](https://developer.android.com/reference/android/widget/ThemedSpinnerAdapter#setDropDownViewTheme(android.content.res.Resources.Theme)).

<br />

|                                                                                                                                            Returns                                                                                                                                             ||
|------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme) | the[Resources.Theme](https://developer.android.com/reference/android/content/res/Resources.Theme)against which drop-down views are inflated, or`null`if one has not been explicitly set <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[Adapter](https://developer.android.com/reference/android/widget/Adapter)classes.

<br />

<br />

|                                                     Returns                                                     ||
|-------------------------------------------------------------------------|----------------------------------------|
| [Filter](https://developer.android.com/reference/android/widget/Filter) | a filter used to constrain data <br /> |

### getFilterQueryProvider

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

```
public FilterQueryProvider getFilterQueryProvider ()
```

Returns the query filter provider used for filtering. When the provider is null, no filtering occurs.

<br />

|                                                                                 Returns                                                                                  ||
|---------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------|
| [FilterQueryProvider](https://developer.android.com/reference/android/widget/FilterQueryProvider) | the current filter query provider or null if it does not exist <br /> |

**See also:**

- [setFilterQueryProvider(android.widget.FilterQueryProvider)](https://developer.android.com/reference/android/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider))
- [runQueryOnBackgroundThread(CharSequence)](https://developer.android.com/reference/android/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence))  

### getItem

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

```
public Object 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                                                     ||
|--------------------------------------------------------------------|--------------------------------------------|
| [Object](https://developer.android.com/reference/java/lang/Object) | The data at the specified position. <br /> |

**See also:**

- [Adapter.getItem(int)](https://developer.android.com/reference/android/widget/Adapter#getItem(int))  

### 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 /> |

**See also:**

- [Adapter.getItemId(int)](https://developer.android.com/reference/android/widget/Adapter#getItemId(int))  

### 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[LayoutInflater.inflate(int, android.view.ViewGroup, boolean)](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`: The old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. Heterogeneous lists can specify their number of view types, so that this View is always of the right type (see[BaseAdapter.getViewTypeCount()](https://developer.android.com/reference/android/widget/BaseAdapter#getViewTypeCount())and[BaseAdapter.getItemViewType(int)](https://developer.android.com/reference/android/widget/BaseAdapter#getItemViewType(int))). <br /> |
| `parent`      | `ViewGroup`: The parent that this view will eventually be attached to <br />                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |

|                                                                Returns                                                                ||
|-------------------------------------------------------------------|--------------------------------------------------------------------|
| [View](https://developer.android.com/reference/android/view/View) | A View corresponding to the data at the specified position. <br /> |

**See also:**

- [Adapter.getView(int, View, ViewGroup)](https://developer.android.com/reference/android/widget/Adapter#getView(int,%20android.view.View,%20android.view.ViewGroup))  

### hasStableIds

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

```
public boolean hasStableIds ()
```

Indicates whether the item ids are stable across changes to the underlying data.

<br />

|                                 Returns                                 ||
|-----------|--------------------------------------------------------------|
| `boolean` | True if the same id always refers to the same object. <br /> |

### newDropDownView

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

```
public View newDropDownView (Context context, 
                Cursor cursor, 
                ViewGroup parent)
```

Makes a new drop down view to hold the data pointed to by cursor.

<br />

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: Interface to application's global information <br />                                              |
| `cursor`  | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `parent`  | `ViewGroup`: The parent to which the new view is attached to <br />                                          |

|                                              Returns                                              ||
|-------------------------------------------------------------------|--------------------------------|
| [View](https://developer.android.com/reference/android/view/View) | the newly created view. <br /> |

### newView

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

```
public abstract View newView (Context context, 
                Cursor cursor, 
                ViewGroup parent)
```

Makes a new view to hold the data pointed to by cursor.

<br />

|                                                       Parameters                                                        ||
|-----------|--------------------------------------------------------------------------------------------------------------|
| `context` | `Context`: Interface to application's global information <br />                                              |
| `cursor`  | `Cursor`: The cursor from which to get the data. The cursor is already moved to the correct position. <br /> |
| `parent`  | `ViewGroup`: The parent to which the new view is attached to <br />                                          |

|                                              Returns                                              ||
|-------------------------------------------------------------------|--------------------------------|
| [View](https://developer.android.com/reference/android/view/View) | the newly created view. <br /> |

### runQueryOnBackgroundThread

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

```
public Cursor runQueryOnBackgroundThread (CharSequence constraint)
```

Runs a query with the specified constraint. This query is requested by the filter attached to this adapter. The query is provided by a[FilterQueryProvider](https://developer.android.com/reference/android/widget/FilterQueryProvider). If no provider is specified, the current cursor is not filtered and returned. After this method returns the resulting cursor is passed to[changeCursor(android.database.Cursor)](https://developer.android.com/reference/android/widget/CursorAdapter#changeCursor(android.database.Cursor))and the previous cursor is closed. This method is always executed on a background thread, not on the application's main thread (or UI thread.) Contract: when constraint is null or empty, the original results, prior to any filtering, must be returned.  
This method may take several seconds to complete, so it should only be called from a worker thread.

<br />

|                                        Parameters                                         ||
|--------------|-----------------------------------------------------------------------------|
| `constraint` | `CharSequence`: the constraint with which the query must be filtered <br /> |

|                                                               Returns                                                                ||
|---------------------------------------------------------------------------|-----------------------------------------------------------|
| [Cursor](https://developer.android.com/reference/android/database/Cursor) | a Cursor representing the results of the new query <br /> |

**See also:**

- [getFilter()](https://developer.android.com/reference/android/widget/CursorAdapter#getFilter())
- [getFilterQueryProvider()](https://developer.android.com/reference/android/widget/CursorAdapter#getFilterQueryProvider())
- [setFilterQueryProvider(android.widget.FilterQueryProvider)](https://developer.android.com/reference/android/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider))  

### 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[Resources.Theme](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[Context](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:**

- [newDropDownView(Context, Cursor, ViewGroup)](https://developer.android.com/reference/android/widget/CursorAdapter#newDropDownView(android.content.Context,%20android.database.Cursor,%20android.view.ViewGroup))  

### setFilterQueryProvider

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

```
public void setFilterQueryProvider (FilterQueryProvider filterQueryProvider)
```

Sets the query filter provider used to filter the current Cursor. The provider's[FilterQueryProvider.runQuery(CharSequence)](https://developer.android.com/reference/android/widget/FilterQueryProvider#runQuery(java.lang.CharSequence))method is invoked when filtering is requested by a client of this adapter.

<br />

|                                             Parameters                                              ||
|-----------------------|------------------------------------------------------------------------------|
| `filterQueryProvider` | `FilterQueryProvider`: the filter query provider or null to remove it <br /> |

**See also:**

- [getFilterQueryProvider()](https://developer.android.com/reference/android/widget/CursorAdapter#getFilterQueryProvider())
- [runQueryOnBackgroundThread(CharSequence)](https://developer.android.com/reference/android/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence))  

### swapCursor

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

```
public Cursor swapCursor (Cursor newCursor)
```

Swap in a new Cursor, returning the old Cursor. Unlike[changeCursor(android.database.Cursor)](https://developer.android.com/reference/android/widget/CursorAdapter#changeCursor(android.database.Cursor)), the returned old Cursor is*not*closed.

<br />

|                        Parameters                        ||
|-------------|---------------------------------------------|
| `newCursor` | `Cursor`: The new cursor to be used. <br /> |

|                                                                                                                       Returns                                                                                                                        ||
|---------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Cursor](https://developer.android.com/reference/android/database/Cursor) | Returns the previously set Cursor, or null if there was not one. If the given new Cursor is the same instance is the previously set Cursor, null is also returned. <br /> |

## Protected methods

### init

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

```
protected void init (Context context, 
                Cursor c, 
                boolean autoRequery)
```

<br />

**This method was deprecated in API level 15.**   
Don't use this, use the normal constructor. This will be removed in the future.

<br />

<br />

|           Parameters            ||
|---------------|------------------|
| `context`     | `Context` <br /> |
| `c`           | `Cursor` <br />  |
| `autoRequery` | `boolean` <br /> |

### onContentChanged

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

```
protected void onContentChanged ()
```

Called when the[ContentObserver](https://developer.android.com/reference/android/database/ContentObserver)on the cursor receives a change notification. The default implementation provides the auto-requery logic, but may be overridden by sub classes.

<br />

**See also:**

- [ContentObserver.onChange(boolean)](https://developer.android.com/reference/android/database/ContentObserver#onChange(boolean))