to top
Android APIs
public abstract class

ResourceCursorAdapter

extends CursorAdapter
java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ android.widget.CursorAdapter
       ↳ android.widget.ResourceCursorAdapter
Known Direct Subclasses

Class Overview

An easy adapter that creates views defined in an XML file. You can specify the XML file that defines the appearance of the views.

Summary

[Expand]
Inherited Constants
From class android.widget.CursorAdapter
From interface android.widget.Adapter
Public Constructors
ResourceCursorAdapter(Context context, int layout, Cursor c)
This constructor was deprecated in API level 11. 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.
ResourceCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery)
Constructor with default behavior as per CursorAdapter(Context, Cursor, boolean); it is recommended you not use this, but instead ResourceCursorAdapter(Context, int, Cursor, int).
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.

[Expand]
Inherited Methods
From class android.widget.CursorAdapter
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Adapter
From interface android.widget.Filterable
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter

Public Constructors

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

Added in API level 1

This constructor was deprecated in API level 11.
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.

Constructor the enables auto-requery.

Parameters
context The context where the ListView associated with this adapter is running
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.

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

Added in API level 3

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

Parameters
context The context where the ListView associated with this adapter is running
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.
c The cursor from which to get the data.
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.

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

Added in API level 11

Standard constructor.

Parameters
context The context where the ListView associated with this adapter is running
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.
c The cursor from which to get the data.
flags Flags used to determine the behavior of the adapter, as per CursorAdapter(Context, Cursor, int).

Public Methods

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

Added in API level 1

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

Parameters
context Interface to application's global information
cursor The cursor from which to get the data. The cursor is already moved to the correct position.
parent The parent to which the new view is attached to
Returns
  • the newly created view.

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

Added in API level 1

Inflates view(s) from the specified XML file.

Parameters
context Interface to application's global information
cursor The cursor from which to get the data. The cursor is already moved to the correct position.
parent The parent to which the new view is attached to
Returns
  • the newly created view.

public void setDropDownViewResource (int dropDownLayout)

Added in API level 1

Sets the layout resource of the drop down views.

Parameters
dropDownLayout the layout resources used to create drop down views

public void setViewResource (int layout)

Added in API level 3

Sets the layout resource of the item views.

Parameters
layout the layout resources used to create item views