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

*** ** * ** ***


```
public class SimpleCursorAdapter extends ResourceCursorAdapter
```

<br />

|---|---|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||||
| ↳ | [android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter.html) ||||
|   | ↳ | [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter) |||
|   |   | ↳ | [androidx.cursoradapter.widget.ResourceCursorAdapter](https://developer.android.com/reference/androidx/cursoradapter/widget/ResourceCursorAdapter) ||
|   |   |   | ↳ | [androidx.cursoradapter.widget.SimpleCursorAdapter](https://developer.android.com/reference/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 |
|---|
| `public interface https://developer.android.com/reference/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. |
| `public interface https://developer.android.com/reference/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/androidx/cursoradapter/widget/SimpleCursorAdapter#SimpleCursorAdapter(android.content.Context,int,android.database.Cursor,java.lang.String[],int[]))( https://developer.android.com/reference/android/content/Context.html context, int layout, https://developer.android.com/reference/android/database/Cursor.html c, String[] from, int[] to )` **This method 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/androidx/cursoradapter/widget/SimpleCursorAdapter#SimpleCursorAdapter(android.content.Context,int,android.database.Cursor,java.lang.String[],int[],int)( https://developer.android.com/reference/android/content/Context.html context, int layout, https://developer.android.com/reference/android/database/Cursor.html c, String[] from, int[] to, int flags )` Standard constructor. |

| ### Public methods |
|---|---|
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#bindView(android.view.View,android.content.Context,android.database.Cursor)(https://developer.android.com/reference/android/view/View.html view, https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/database/Cursor.html cursor)` 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. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#changeCursorAndColumns(android.database.Cursor,java.lang.String[],int[])(https://developer.android.com/reference/android/database/Cursor.html c, String[] from, int[] to)` Change the cursor and change the column-to-view mappings at the same time. |
| `https://developer.android.com/reference/java/lang/CharSequence.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#convertToString(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` Returns a CharSequence representation of the specified Cursor as defined by the current CursorToStringConverter. |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()()` Returns the converter used to convert the filtering Cursor into a String. |
| `int` | `https://developer.android.com/reference/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/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getViewBinder()()` Returns the `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder` used to bind data to views. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)( https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter.CursorToStringConverter cursorToStringConverter )` Sets the converter used to convert the filtering Cursor into a String. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)(int stringConversionColumn)` Defines the index of the column in the Cursor used to get a String representation of that Cursor. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder)(https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter.ViewBinder viewBinder)` Sets the binder used to bind data to views. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView,java.lang.String)(https://developer.android.com/reference/android/widget/ImageView.html v, https://developer.android.com/reference/java/lang/String.html value)` 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. |
| `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewText(android.widget.TextView,java.lang.String)(https://developer.android.com/reference/android/widget/TextView.html v, https://developer.android.com/reference/java/lang/String.html text)` 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/androidx/cursoradapter/widget/SimpleCursorAdapter#swapCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html newCursor)` Swap in a new Cursor, returning the old Cursor. |

| ### Inherited Constants |
|---|
| From [android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter.html) |---|---| | `static final int` | `https://developer.android.com/reference/android/widget/Adapter.html#IGNORE_ITEM_VIEW_TYPE = -1` | | `static final int` | `https://developer.android.com/reference/android/widget/Adapter.html#NO_SELECTION = -2147483648` | |
| From [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter) |---|---| | `static final int` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#FLAG_AUTO_REQUERY() = 1` **This field 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 /> | | `static final int` | `https://developer.android.com/reference/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/androidx/cursoradapter/widget/CursorAdapter#onContentChanged()` when a notification comes in. | |

| ### Inherited methods |
|---|
| From [android.widget.Adapter](https://developer.android.com/reference/android/widget/Adapter.html) |---|---| | `abstract int` | `https://developer.android.com/reference/android/widget/Adapter.html#getCount()()` | | `abstract https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/android/widget/Adapter.html#getItem(int)(int p)` | | `abstract long` | `https://developer.android.com/reference/android/widget/Adapter.html#getItemId(int)(int p)` | | `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)(int p, https://developer.android.com/reference/android/view/View.html p1, https://developer.android.com/reference/android/view/ViewGroup.html p2)` | |
| From [android.widget.BaseAdapter](https://developer.android.com/reference/android/widget/BaseAdapter.html) |---|---| | `boolean` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#areAllItemsEnabled()()` | | `CharSequence[]` | `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)(int position, https://developer.android.com/reference/android/view/View.html convertView, https://developer.android.com/reference/android/view/ViewGroup.html parent)` | | `int` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#getItemViewType(int)(int position)` | | `int` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#getViewTypeCount()()` | | `boolean` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#hasStableIds()()` | | `boolean` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#isEmpty()()` | | `boolean` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#isEnabled(int)(int position)` | | `void` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetChanged()()` | | `void` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#notifyDataSetInvalidated()()` | | `void` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#registerDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver.html observer)` | | `void` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#setAutofillOptions(java.lang.CharSequence...)(CharSequence[] options)` | | `void` | `https://developer.android.com/reference/android/widget/BaseAdapter.html#unregisterDataSetObserver(android.database.DataSetObserver)(https://developer.android.com/reference/android/database/DataSetObserver.html observer)` | |
| From [androidx.cursoradapter.widget.CursorAdapter](https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter) |---|---| | `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#changeCursor(android.database.Cursor)(https://developer.android.com/reference/android/database/Cursor.html cursor)` Change the underlying cursor to a new cursor. | | `int` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getCount()()` | | `https://developer.android.com/reference/android/database/Cursor.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getCursor()()` Returns the cursor. | | `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getDropDownView(int,android.view.View,android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View.html convertView, https://developer.android.com/reference/android/view/ViewGroup.html parent)` | | `https://developer.android.com/reference/android/widget/Filter.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getFilter()()` | | `https://developer.android.com/reference/android/widget/FilterQueryProvider.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getFilterQueryProvider()()` Returns the query filter provider used for filtering. | | `https://developer.android.com/reference/java/lang/Object.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getItem(int)(int position)` | | `long` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getItemId(int)(int position)` | | `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#getView(int,android.view.View,android.view.ViewGroup)(int position, https://developer.android.com/reference/android/view/View.html convertView, https://developer.android.com/reference/android/view/ViewGroup.html parent)` | | `boolean` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#hasStableIds()()` | | `void` | `[init](https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#init(android.content.Context,android.database.Cursor,boolean))(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/database/Cursor.html c, boolean autoRequery)` **This method is deprecated.** Don't use this, use the normal constructor. <br /> | | `void` | `https://developer.android.com/reference/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/androidx/cursoradapter/widget/CursorAdapter#runQueryOnBackgroundThread(java.lang.CharSequence)(https://developer.android.com/reference/java/lang/CharSequence.html constraint)` Runs a query with the specified constraint. | | `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#setFilterQueryProvider(android.widget.FilterQueryProvider)(https://developer.android.com/reference/android/widget/FilterQueryProvider.html filterQueryProvider)` 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/androidx/cursoradapter/widget/ResourceCursorAdapter) |---|---| | `https://developer.android.com/reference/android/view/View.html` | `https://developer.android.com/reference/androidx/cursoradapter/widget/ResourceCursorAdapter#newDropDownView(android.content.Context,android.database.Cursor,android.view.ViewGroup)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/database/Cursor.html cursor, https://developer.android.com/reference/android/view/ViewGroup.html parent)` 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/androidx/cursoradapter/widget/ResourceCursorAdapter#newView(android.content.Context,android.database.Cursor,android.view.ViewGroup)(https://developer.android.com/reference/android/content/Context.html context, https://developer.android.com/reference/android/database/Cursor.html cursor, https://developer.android.com/reference/android/view/ViewGroup.html parent)` Inflates view(s) from the specified XML file. | | `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/ResourceCursorAdapter#setDropDownViewResource(int)(int dropDownLayout)` Sets the layout resource of the drop down views. | | `void` | `https://developer.android.com/reference/androidx/cursoradapter/widget/ResourceCursorAdapter#setViewResource(int)(int layout)` 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)

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

> [!CAUTION]
> **This method 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)

```
public SimpleCursorAdapter(
    Context context,
    int layout,
    Cursor c,
    String[] from,
    int[] to,
    int flags
)
```

Standard constructor.

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/content/Context.html context` | The context where the ListView associated with this SimpleListItemFactory is running |
| `int layout` | 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" |
| `https://developer.android.com/reference/android/database/Cursor.html c` | The database cursor. Can be null if the cursor is not available yet. |
| `String[] from` | A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. |
| `int[] to` | 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. |
| `int flags` | Flags used to determine the behavior of the adapter, as per `https://developer.android.com/reference/androidx/cursoradapter/widget/CursorAdapter#CursorAdapter(android.content.Context,android.database.Cursor,int)`. |

## Public methods

### bindView

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

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

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/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/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/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/androidx/cursoradapter/widget/SimpleCursorAdapter#getViewBinder()` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewBinder(androidx.cursoradapter.widget.SimpleCursorAdapter.ViewBinder)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setViewImage(android.widget.ImageView,java.lang.String)` |   |
| `https://developer.android.com/reference/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)

```
public void changeCursorAndColumns(Cursor c, String[] from, int[] to)
```

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

| Parameters |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html c` | The database cursor. Can be null if the cursor is not available yet. |
| `String[] from` | A list of column names representing the data to bind to the UI. Can be null if the cursor is not available yet. |
| `int[] to` | 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

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

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 |
|---|---|
| `https://developer.android.com/reference/android/database/Cursor.html cursor` | the Cursor to convert to a CharSequence |

| Returns |
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence.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)

```
public SimpleCursorAdapter.CursorToStringConverter getCursorToStringConverter()
```

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

| Returns |
|---|---|
| `https://developer.android.com/reference/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/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/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)

```
public int getStringConversionColumn()
```

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

| Returns |
|---|---|
| `int` | 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/androidx/cursoradapter/widget/SimpleCursorAdapter#setStringConversionColumn(int)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()` |   |

### getViewBinder

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

```
public SimpleCursorAdapter.ViewBinder getViewBinder()
```

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#bindView(android.view.View,android.content.Context,android.database.Cursor)` |   |
| `https://developer.android.com/reference/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)

```
public void setCursorToStringConverter(
    SimpleCursorAdapter.CursorToStringConverter cursorToStringConverter
)
```

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

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

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/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)

```
public void setStringConversionColumn(int stringConversionColumn)
```

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 |
|---|---|
| `int stringConversionColumn` | 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/androidx/cursoradapter/widget/SimpleCursorAdapter#getStringConversionColumn()` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#setCursorToStringConverter(androidx.cursoradapter.widget.SimpleCursorAdapter.CursorToStringConverter)` |   |
| `https://developer.android.com/reference/androidx/cursoradapter/widget/SimpleCursorAdapter#getCursorToStringConverter()` |   |

### setViewBinder

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

```
public void setViewBinder(SimpleCursorAdapter.ViewBinder viewBinder)
```

Sets the binder used to bind data to views.

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

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

### setViewImage

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

```
public void setViewImage(ImageView v, String value)
```

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 |
|---|---|
| `https://developer.android.com/reference/android/widget/ImageView.html v` | ImageView to receive an image |
| `https://developer.android.com/reference/java/lang/String.html value` | the value retrieved from the cursor |

### setViewText

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

```
public void setViewText(TextView v, String text)
```

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 |
|---|---|
| `https://developer.android.com/reference/android/widget/TextView.html v` | TextView to receive text |
| `https://developer.android.com/reference/java/lang/String.html text` | the text to be set for the TextView |

### swapCursor

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

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

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