ResourceCursorAdapter

public abstract class ResourceCursorAdapter extends CursorAdapter

Known direct subclasses
SimpleCursorAdapter

Static library support version of the framework's android.widget.SimpleCursorAdapter.


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

Public constructors

ResourceCursorAdapter(Context context, int layout, Cursor c)

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.

ResourceCursorAdapter(
    Context context,
    int layout,
    Cursor c,
    boolean autoRequery
)

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.

ResourceCursorAdapter(Context context, int layout, Cursor c, int flags)

Standard constructor.

Public methods

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

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

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

Inflates view(s) from the specified XML file.

void
setDropDownViewResource(int dropDownLayout)

Sets the layout resource of the drop down views.

void
setViewResource(int layout)

Sets the layout resource of the item views.

Inherited Constants

From android.widget.Adapter
static final int
static final int
NO_SELECTION = -2147483648
From androidx.cursoradapter.widget.CursorAdapter
static final int

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.

static final int

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

Inherited methods

From android.widget.Adapter
abstract int
abstract Object
getItem(int p)
abstract long
getItemId(int p)
abstract View
getView(int p, View p1, ViewGroup p2)
From android.widget.BaseAdapter
boolean
CharSequence[]
View
getDropDownView(int position, View convertView, ViewGroup parent)
int
getItemViewType(int position)
int
boolean
boolean
boolean
isEnabled(int position)
void
void
void
void
setAutofillOptions(CharSequence[] options)
void
From androidx.cursoradapter.widget.CursorAdapter
abstract void
bindView(View view, Context context, Cursor cursor)

Bind an existing view to the data pointed to by cursor

void

Change the underlying cursor to a new cursor.

CharSequence

Converts the cursor into a CharSequence.

int
Cursor

Returns the cursor.

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

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
void
init(Context context, Cursor c, boolean autoRequery)

This method is deprecated.

Don't use this, use the normal constructor.

void

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

Cursor

Runs a query with the specified constraint.

void

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

Cursor
swapCursor(Cursor newCursor)

Swap in a new Cursor, returning the old Cursor.

From android.widget.Filterable
abstract Filter

Public constructors

ResourceCursorAdapter

Added in 1.0.0
Deprecated in 1.0.0
public ResourceCursorAdapter(Context context, int layout, Cursor c)

Constructor the enables auto-requery.

Parameters
Context context

The context where the ListView associated with this adapter is running

int layout

resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.

ResourceCursorAdapter

Added in 1.0.0
Deprecated in 1.0.0
public ResourceCursorAdapter(
    Context context,
    int layout,
    Cursor c,
    boolean autoRequery
)

Constructor with default behavior as per CursorAdapter; it is recommended you not use this, but instead ResourceCursorAdapter. When using this constructor, FLAG_REGISTER_CONTENT_OBSERVER will always be set.

Parameters
Context context

The context where the ListView associated with this adapter is running

int layout

resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.

Cursor c

The cursor from which to get the data.

boolean autoRequery

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.

ResourceCursorAdapter

Added in 1.0.0
public ResourceCursorAdapter(Context context, int layout, Cursor c, int flags)

Standard constructor.

Parameters
Context context

The context where the ListView associated with this adapter is running

int layout

Resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.

Cursor c

The cursor from which to get the data.

int flags

Flags used to determine the behavior of the adapter, as per CursorAdapter.

Public methods

newDropDownView

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

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

Parameters
Context context

Interface to application's global information

Cursor cursor

The cursor from which to get the data. The cursor is already moved to the correct position.

ViewGroup parent

The parent to which the new view is attached to

Returns
View

the newly created view.

newView

Added in 1.1.0-alpha01
public View newView(Context context, Cursor cursor, ViewGroup parent)

Inflates view(s) from the specified XML file.

See also
newView

setDropDownViewResource

Added in 1.0.0
public void setDropDownViewResource(int dropDownLayout)

Sets the layout resource of the drop down views.

Parameters
int dropDownLayout

the layout resources used to create drop down views

setViewResource

Added in 1.0.0
public void setViewResource(int layout)

Sets the layout resource of the item views.

Parameters
int layout

the layout resources used to create item views