A basic adapter to map columns from a cursor(of Database) to TextViews or ImageViews defined in an XML layout file.
A basic adapter to map columns from a cursor(of Database) to TextViews or ImageViews defined in an XML layout file. Although the SimpleCursorAdapter is a basic adapter it can implement a more complex data-views binding by assigning it a ViewBinder
instance to supplement the binding logic.
From the documentation of the SimpleCursorAdapter
class:
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
SimpleCursorAdapter.ViewBinder
is available,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,setViewText(TextView, String)
is invoked. If the returned value is false and the view to bind is an ImageView, setViewImage(ImageView, String) is invoked. If no appropriate binding can be found, anIllegalStateException
is thrown. If this adapter is used with filtering, for instance in anAutoCompleteTextView
, you can use theSimpleCursorAdapter.CursorToStringConverter
and theFilterQueryProvider
interfaces to get control over the filtering process. You can refer toconvertToString(android.database.Cursor)
andrunQueryOnBackgroundThread(CharSequence)
for more information.
Tag Usage:
android android-listview expandablelistview baseadapter android-cursoradapter