CursorAdapter

public abstract class CursorAdapter
extends BaseAdapter implements Filterable

java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ androidx.cursoradapter.widget.CursorAdapter


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

Constants

int FLAG_AUTO_REQUERY

This constant 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 with a CursorLoader.

int FLAG_REGISTER_CONTENT_OBSERVER

If set the adapter will register a content observer on the cursor and will call onContentChanged() when a notification comes in.

Inherited constants

Public constructors

CursorAdapter(Context context, 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 with a CursorLoader.

CursorAdapter(Context context, Cursor c, boolean autoRequery)

Constructor that allows control over auto-requery.

CursorAdapter(Context context, Cursor c, int flags)

Recommended constructor.

Public methods

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

Bind an existing view to the data pointed to by cursor

void changeCursor(Cursor cursor)

Change the underlying cursor to a new cursor.

CharSequence convertToString(Cursor cursor)

Converts the cursor into a CharSequence.

int getCount()
Cursor getCursor()

Returns the cursor.

View getDropDownView(int position, View convertView, ViewGroup parent)
Filter getFilter()
FilterQueryProvider getFilterQueryProvider()

Returns the query filter provider used for filtering.

Object getItem(int position)
long getItemId(int position)
View getView(int position, View convertView, ViewGroup parent)
boolean hasStableIds()
View newDropDownView(Context context, Cursor cursor, ViewGroup parent)

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

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

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

Cursor runQueryOnBackgroundThread(CharSequence constraint)

Runs a query with the specified constraint.

void setFilterQueryProvider(FilterQueryProvider filterQueryProvider)

Sets the query filter provider used to filter the current Cursor.

Cursor swapCursor(Cursor newCursor)

Swap in a new Cursor, returning the old Cursor.

Protected methods

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

This method is deprecated. Don't use this, use the normal constructor. This will be removed in the future.

void onContentChanged()

Called when the ContentObserver on the cursor receives a change notification.

Inherited methods