Android Guides | Samples

Android.Widget.SimpleCursorAdapter Class

An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file.

See Also: SimpleCursorAdapter

Syntax

[Android.Runtime.Register("android/widget/SimpleCursorAdapter", DoNotGenerateAcw=true)]
public class SimpleCursorAdapter : ResourceCursorAdapter

Remarks

An easy adapter to map columns from a cursor to TextViews or ImageViews defined in an XML file. You can specify which columns you want, which views you want to display the columns, and the XML file that defines the appearance of these views. Binding occurs in two phases. First, if a NoType:android/widget/SimpleCursorAdapter$ViewBinder;Href=../../../reference/android/widget/SimpleCursorAdapter.ViewBinder.html is available, NoType:android/widget/SimpleCursorAdapter$ViewBinder;Href=../../../reference/android/widget/SimpleCursorAdapter.ViewBinder.html#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, SimpleCursorAdapter.SetViewText(TextView,String) is invoked. If the returned value is false and the view to bind is an ImageView, SimpleCursorAdapter.SetViewImage(ImageView,String) is invoked. If no appropriate binding can be found, an IllegalStateException is thrown. If this adapter is used with filtering, for instance in an AutoCompleteTextView, you can use the NoType:android/widget/SimpleCursorAdapter$CursorToStringConverter;Href=../../../reference/android/widget/SimpleCursorAdapter.CursorToStringConverter.html and the IFilterQueryProvider interfaces to get control over the filtering process. You can refer to SimpleCursorAdapter.convertToString(android.database.Cursor) and CursorAdapter.RunQueryOnBackgroundThread(ICharSequence) for more information.

[Android Documentation]

Requirements

Namespace: Android.Widget
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 1

The members of Android.Widget.SimpleCursorAdapter are listed below.

See Also: ResourceCursorAdapter

Public Constructors

Constructor the enables auto-requery.
Standard constructor.

Protected Constructors

A constructor used when creating managed representations of JNI objects; called by the runtime.

Public Properties

CursorToStringConverterSimpleCursorAdapter+ICursorToStringConverter. Returns the converter used to convert the filtering Cursor into a String.
StringConversionColumnInt32. Return the index of the column used to get a String representation of the Cursor.
ViewBinderSimpleCursorAdapter+IViewBinder. Returns the NoType:android/widget/SimpleCursorAdapter$ViewBinder;Href=../../../reference/android/widget/SimpleCursorAdapter.ViewBinder.html used to bind data to views.

Protected Properties

[read-only]
override
ThresholdClassIntPtr. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.
[read-only]
override
ThresholdTypeType. This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Public Methods

override
BindView(View, Context, ICursor)
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.
ChangeCursorAndColumns(ICursor, String[], Int32[])
Change the cursor and change the column-to-view mappings at the same time.
SetViewImage(ImageView, String)
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.
SetViewText(TextView, String)
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.