added in version 22.1.0
belongs to Maven artifact com.android.support:cursoradapter:28.0.0-alpha1

SimpleCursorAdapter

public class SimpleCursorAdapter
extends ResourceCursorAdapter

java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ android.support.v4.widget.CursorAdapter
       ↳ android.support.v4.widget.ResourceCursorAdapter
         ↳ android.support.v4.widget.SimpleCursorAdapter


Static library support version of the framework's SimpleCursorAdapter. 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 classes

interface SimpleCursorAdapter.CursorToStringConverter

This class can be used by external clients of SimpleCursorAdapter to define how the Cursor should be converted to a String. 

interface SimpleCursorAdapter.ViewBinder

This class can be used by external clients of SimpleCursorAdapter to bind values fom the Cursor to views. 

Inherited constants

From class android.support.v4.widget.CursorAdapter
From interface android.widget.Adapter

Public constructors

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

This constructor was deprecated in API level 22.1.0. 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 with a CursorLoader.

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

Standard constructor.

Public methods

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.

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

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

CharSequence convertToString(Cursor cursor)

Returns a CharSequence representation of the specified Cursor as defined by the current CursorToStringConverter.

SimpleCursorAdapter.CursorToStringConverter getCursorToStringConverter()

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

int getStringConversionColumn()

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

SimpleCursorAdapter.ViewBinder getViewBinder()

Returns the SimpleCursorAdapter.ViewBinder used to bind data to views.

void setCursorToStringConverter(SimpleCursorAdapter.CursorToStringConverter cursorToStringConverter)

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

void setStringConversionColumn(int stringConversionColumn)

Defines the index of the column in the Cursor used to get a String representation of that Cursor.

void setViewBinder(SimpleCursorAdapter.ViewBinder viewBinder)

Sets the binder used to bind data to views.

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.

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.

Cursor swapCursor(Cursor c)

Swap in a new Cursor, returning the old Cursor.

Inherited methods

From class android.support.v4.widget.ResourceCursorAdapter
From class android.support.v4.widget.CursorAdapter
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Filterable