# SimpleCursorAdapter

Artifact: [androidx.cursoradapter:cursoradapter](https://developer.android.com/jetpack/androidx/releases/cursoradapter) [View Source](https://cs.android.com/search?q=file:androidx/cursoradapter/widget/SimpleCursorAdapter.java+class:androidx.cursoradapter.widget.SimpleCursorAdapter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

*** ** * ** ***

<br />

```
class SimpleCursorAdapter : ResourceCursorAdapter
```

<br />

|---|---|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||||
| ↳ | [android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter.html) ||||
|   | ↳ | [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter) |||
|   |   | ↳ | [androidx.cursoradapter.widget.ResourceCursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter) ||
|   |   |   | ↳ | [androidx.cursoradapter.widget.SimpleCursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter) |

*** ** * ** ***

Static library support version of the framework's `https://developer.android.com/reference/android/widget/SimpleCursorAdapter.html`. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.

## Summary

| ### Nested types |
|---|
| `interface https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter` This class can be used by external clients of SimpleCursorAdapter to define how the Cursor should be converted to a String. |
| `interface https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder` This class can be used by external clients of SimpleCursorAdapter to bind values fom the Cursor to views. |

| ### Public constructors |
|---|
| `[SimpleCursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#SimpleCursorAdapter(android.content.Context,int,android.database.Cursor,java.lang.String[],int[]))( context: https://developer.android.com/reference/android/content/Context.html!, layout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, c: https://developer.android.com/reference/android/database/Cursor.html!, from: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, to: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>! )` **This function 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. <br /> |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#SimpleCursorAdapter(android.content.Context,int,android.database.Cursor,java.lang.String[],int[],int)( context: https://developer.android.com/reference/android/content/Context.html!, layout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, c: https://developer.android.com/reference/android/database/Cursor.html!, from: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, to: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!, flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Standard constructor. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#bindView(android.view.View,android.content.Context,android.database.Cursor)(view: https://developer.android.com/reference/android/view/View.html!, context: https://developer.android.com/reference/android/content/Context.html!, cursor: https://developer.android.com/reference/android/database/Cursor.html!)` Binds all of the field names passed into the "to" parameter of the constructor with their corresponding cursor columns as specified in the "from" parameter. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#changeCursorAndColumns(android.database.Cursor,java.lang.String[],int[])(c: https://developer.android.com/reference/android/database/Cursor.html!, from: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!, to: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!)` Change the cursor and change the column-to-view mappings at the same time. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#convertToString(android.database.Cursor)(cursor: https://developer.android.com/reference/android/database/Cursor.html!)` Returns a CharSequence representation of the specified Cursor as defined by the current CursorToStringConverter. |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter!` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()()` Returns the converter used to convert the filtering Cursor into a String. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()()` Return the index of the column used to get a String representation of the Cursor. |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder!` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getViewBinder()()` Returns the `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder` used to bind data to views. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)( cursorToStringConverter: https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter! )` Sets the converter used to convert the filtering Cursor into a String. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)(stringConversionColumn: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Defines the index of the column in the Cursor used to get a String representation of that Cursor. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder)(viewBinder: https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder!)` Sets the binder used to bind data to views. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView,java.lang.String)(v: https://developer.android.com/reference/android/widget/ImageView.html!, value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Called by bindView() to set the image for an ImageView but only if there is no existing ViewBinder or if the existing ViewBinder cannot handle binding to an ImageView. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewText(android.widget.TextView,java.lang.String)(v: https://developer.android.com/reference/android/widget/TextView.html!, text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!)` Called by bindView() to set the text for a TextView but only if there is no existing ViewBinder or if the existing ViewBinder cannot handle binding to a TextView. |
| `https://developer.android.com/reference/android/database/Cursor.html!` | `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#swapCursor(android.database.Cursor)(newCursor: https://developer.android.com/reference/android/database/Cursor.html!)` Swap in a new Cursor, returning the old Cursor. |

### Inherited Constants

From [android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter.html) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/widget/Adapter.html#IGNORE_ITEM_VIEW_TYPE = -1` `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/widget/Adapter.html#NO_SELECTION = -2147483648` From [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter) `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#FLAG_AUTO_REQUERY() = 1`

**This property 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.

<br />

`const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#FLAG_REGISTER_CONTENT_OBSERVER() = 2`

If set the adapter will register a content observer on the cursor and will call `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#onContentChanged()` when a notification comes in.

### Inherited functions

From [android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter.html) `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/widget/Adapter.html#getCount()()` `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` `https://developer.android.com/reference/android/widget/Adapter.html#getItem(int)(p: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `abstract https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/android/widget/Adapter.html#getItemId(int)(p: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `abstract https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/android/widget/Adapter.html#getView(int, android.view.View, android.view.ViewGroup)(p: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, p1: https://developer.android.com/reference/android/view/View.html!, p2: https://developer.android.com/reference/android/view/ViewGroup.html!)` From [android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter.html) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#areAllItemsEnabled()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!>!` `https://developer.android.com/reference/android/widget/BaseAdapter.html#getAutofillOptions()()` `https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/android/widget/BaseAdapter.html#getDropDownView(int, android.view.View, android.view.ViewGroup)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, convertView: https://developer.android.com/reference/android/view/View.html!, parent: https://developer.android.com/reference/android/view/ViewGroup.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#getItemViewType(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#getViewTypeCount()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#hasStableIds()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#isEmpty()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#isEnabled(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetInvalidated()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#registerDataSetObserver(android.database.DataSetObserver)(observer: https://developer.android.com/reference/android/database/DataSetObserver.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#setAutofillOptions(java.lang.CharSequence...)(options: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!>!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/android/widget/BaseAdapter.html#unregisterDataSetObserver(android.database.DataSetObserver)(observer: https://developer.android.com/reference/android/database/DataSetObserver.html!)` From [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#changeCursor(android.database.Cursor)(cursor: https://developer.android.com/reference/android/database/Cursor.html!)`

Change the underlying cursor to a new cursor.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getCount()()` `https://developer.android.com/reference/android/database/Cursor.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getCursor()()`

Returns the cursor.
`https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getDropDownView(int,android.view.View,android.view.ViewGroup)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, convertView: https://developer.android.com/reference/android/view/View.html!, parent: https://developer.android.com/reference/android/view/ViewGroup.html!)` `https://developer.android.com/reference/android/widget/Filter.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getFilter()()` `https://developer.android.com/reference/android/widget/FilterQueryProvider.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getFilterQueryProvider()()`

Returns the query filter provider used for filtering.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getItem(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getItemId(int)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` `https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#getView(int,android.view.View,android.view.ViewGroup)(position: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, convertView: https://developer.android.com/reference/android/view/View.html!, parent: https://developer.android.com/reference/android/view/ViewGroup.html!)` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#hasStableIds()()` `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `[init](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#init(android.content.Context,android.database.Cursor,boolean))(context: https://developer.android.com/reference/android/content/Context.html!, c: https://developer.android.com/reference/android/database/Cursor.html!, autoRequery: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)`

**This function is deprecated.**

Don't use this, use the normal constructor.

<br />

`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#onContentChanged()()`

Called when the `https://developer.android.com/reference/android/database/ContentObserver.html` on the cursor receives a change notification.
`https://developer.android.com/reference/android/database/Cursor.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence)(constraint: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!)`

Runs a query with the specified constraint.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider)(filterQueryProvider: https://developer.android.com/reference/android/widget/FilterQueryProvider.html!)`

Sets the query filter provider used to filter the current Cursor.
From [android.widget.Filterable](https://developer.android.com/reference/android/widget/Filterable.html) `abstract https://developer.android.com/reference/android/widget/Filter.html!` `https://developer.android.com/reference/android/widget/Filterable.html#getFilter()()` From [androidx.cursoradapter.widget.ResourceCursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter) `https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter#newDropDownView(android.content.Context,android.database.Cursor,android.view.ViewGroup)(context: https://developer.android.com/reference/android/content/Context.html!, cursor: https://developer.android.com/reference/android/database/Cursor.html!, parent: https://developer.android.com/reference/android/view/ViewGroup.html!)`

Makes a new drop down view to hold the data pointed to by cursor.
`https://developer.android.com/reference/android/view/View.html!` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter#newView(android.content.Context,android.database.Cursor,android.view.ViewGroup)(context: https://developer.android.com/reference/android/content/Context.html!, cursor: https://developer.android.com/reference/android/database/Cursor.html!, parent: https://developer.android.com/reference/android/view/ViewGroup.html!)`

Inflates view(s) from the specified XML file.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter#setDropDownViewResource(int)(dropDownLayout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the layout resource of the drop down views.
`https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/ResourceCursorAdapter#setViewResource(int)(layout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`

Sets the layout resource of the item views.

## Public constructors

### SimpleCursorAdapter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0) Deprecated in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
[SimpleCursorAdapter](https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#SimpleCursorAdapter(android.content.Context,int,android.database.Cursor,java.lang.String[],int[]))(
    context: Context!,
    layout: Int,
    c: Cursor!,
    from: Array<String!>!,
    to: IntArray<Int>!
)
```

> [!CAUTION]
> **This function 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 `https://developer.android.com/reference/android/app/LoaderManager.html` with a `https://developer.android.com/reference/android/content/CursorLoader.html`.

Constructor the enables auto-requery.

### SimpleCursorAdapter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
SimpleCursorAdapter(
    context: Context!,
    layout: Int,
    c: Cursor!,
    from: Array<String!>!,
    to: IntArray<Int>!,
    flags: Int
)
```

Standard constructor.

| Parameters |
|---|---|
| `context: https://developer.android.com/reference/android/content/Context.html!` | The context where the ListView associated with this SimpleListItemFactory is running |
| `layout: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | resource identifier of a layout file that defines the views for this list item. The layout file should include at least those named views defined in "to" |
| `c: https://developer.android.com/reference/android/database/Cursor.html!` | The database cursor. Can be null if the cursor is not available yet. |
| `from: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. |
| `to: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The views that should display column in the "from" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the from parameter. Can be null if the cursor is not available yet. |
| `flags: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | Flags used to determine the behavior of the adapter, as per `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/CursorAdapter#CursorAdapter(android.content.Context,android.database.Cursor,int)`. |

## Public functions

### bindView

Added in [1.1.0-alpha01](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.1.0-alpha01)

```
fun bindView(view: View!, context: Context!, cursor: Cursor!): Unit
```

Binds all of the field names passed into the "to" parameter of the constructor with their corresponding cursor columns as specified in the "from" parameter. Binding occurs in two phases. First, if a `https://developer.android.com/reference/android/widget/SimpleCursorAdapter.ViewBinder.html` is available, `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder#setViewValue(android.view.View,android.database.Cursor,int)` is invoked. If the returned value is true, binding has occured. If the returned value is false and the view to bind is a TextView, `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewText(android.widget.TextView,java.lang.String)` is invoked. If the returned value is false and the view to bind is an ImageView, `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView,java.lang.String)` is invoked. If no appropriate binding can be found, an `https://developer.android.com/reference/java/lang/IllegalStateException.html` is thrown.

| Throws |
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException.html` | if binding cannot occur |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/CursorAdapter.html#bindView(android.view.View, android.content.Context, android.database.Cursor)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getViewBinder()` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView,java.lang.String)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewText(android.widget.TextView,java.lang.String)` |   |

### changeCursorAndColumns

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun changeCursorAndColumns(c: Cursor!, from: Array<String!>!, to: IntArray<Int>!): Unit
```

Change the cursor and change the column-to-view mappings at the same time.

| Parameters |
|---|---|
| `c: https://developer.android.com/reference/android/database/Cursor.html!` | The database cursor. Can be null if the cursor is not available yet. |
| `from: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!>!` | A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. |
| `to: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int-array/index.html<https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html>!` | The views that should display column in the "from" parameter. These should all be TextViews. The first N views in this list are given the values of the first N columns in the from parameter. Can be null if the cursor is not available yet. |

### convertToString

```
fun convertToString(cursor: Cursor!): CharSequence!
```

Returns a CharSequence representation of the specified Cursor as defined by the current CursorToStringConverter. If no CursorToStringConverter has been set, the String conversion column is used instead. If the conversion column is -1, the returned String is empty if the cursor is null or Cursor.toString().

| Parameters |
|---|---|
| `cursor: https://developer.android.com/reference/android/database/Cursor.html!` | the Cursor to convert to a CharSequence |

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-char-sequence/index.html!` | a non-null CharSequence representing the cursor |

### getCursorToStringConverter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun getCursorToStringConverter(): SimpleCursorAdapter.CursorToStringConverter!
```

Returns the converter used to convert the filtering Cursor into a String.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter!` | null if the converter does not exist or an instance of `https://developer.android.com/reference/android/widget/SimpleCursorAdapter.CursorToStringConverter.html` |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)` |   |
| `https://developer.android.com/reference/android/widget/CursorAdapter.html#convertToString(android.database.Cursor)` |   |

### getStringConversionColumn

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun getStringConversionColumn(): Int
```

Return the index of the column used to get a String representation of the Cursor.

| Returns |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a valid index in the current Cursor or -1 |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/CursorAdapter.html#convertToString(android.database.Cursor)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()` |   |

### getViewBinder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun getViewBinder(): SimpleCursorAdapter.ViewBinder!
```

Returns the `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder` used to bind data to views.

| Returns |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder!` | a ViewBinder or null if the binder does not exist |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#bindView(android.view.View,android.content.Context,android.database.Cursor)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder)` |   |

### setCursorToStringConverter

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun setCursorToStringConverter(
    cursorToStringConverter: SimpleCursorAdapter.CursorToStringConverter!
): Unit
```

Sets the converter used to convert the filtering Cursor into a String.

| Parameters |
|---|---|
| `cursorToStringConverter: https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter!` | the Cursor to String converter, or null to remove the converter |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)` |   |
| `https://developer.android.com/reference/android/widget/CursorAdapter.html#convertToString(android.database.Cursor)` |   |

### setStringConversionColumn

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun setStringConversionColumn(stringConversionColumn: Int): Unit
```

Defines the index of the column in the Cursor used to get a String representation of that Cursor. The column is used to convert the Cursor to a String only when the current CursorToStringConverter is null.

| Parameters |
|---|---|
| `stringConversionColumn: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | a valid index in the current Cursor or -1 to use the default conversion mechanism |

| See also |
|---|---|
| `https://developer.android.com/reference/android/widget/CursorAdapter.html#convertToString(android.database.Cursor)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()` |   |

### setViewBinder

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun setViewBinder(viewBinder: SimpleCursorAdapter.ViewBinder!): Unit
```

Sets the binder used to bind data to views.

| Parameters |
|---|---|
| `viewBinder: https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder!` | the binder used to bind data to views, can be null to remove the existing binder |

| See also |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#bindView(android.view.View,android.content.Context,android.database.Cursor)` |   |
| `https://developer.android.com/reference/kotlin/androidx/cursoradapter/widget/SimpleCursorAdapter#getViewBinder()` |   |

### setViewImage

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun setViewImage(v: ImageView!, value: String!): Unit
```

Called by bindView() to set the image for an ImageView but only if there is no existing ViewBinder or if the existing ViewBinder cannot handle binding to an ImageView. By default, the value will be treated as an image resource. If the value cannot be used as an image resource, the value is used as an image Uri. Intended to be overridden by Adapters that need to filter strings retrieved from the database.

| Parameters |
|---|---|
| `v: https://developer.android.com/reference/android/widget/ImageView.html!` | ImageView to receive an image |
| `value: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | the value retrieved from the cursor |

### setViewText

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/cursoradapter#1.0.0)

```
fun setViewText(v: TextView!, text: String!): Unit
```

Called by bindView() to set the text for a TextView but only if there is no existing ViewBinder or if the existing ViewBinder cannot handle binding to a TextView. Intended to be overridden by Adapters that need to filter strings retrieved from the database.

| Parameters |
|---|---|
| `v: https://developer.android.com/reference/android/widget/TextView.html!` | TextView to receive text |
| `text: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html!` | the text to be set for the TextView |

### swapCursor

```
fun swapCursor(newCursor: Cursor!): Cursor!
```

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

| Parameters |
|---|---|
| `newCursor: https://developer.android.com/reference/android/database/Cursor.html!` | The new cursor to be used. |

| Returns |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html!` | 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. |