1.public Interface Cursor
|-android.database.cursor
The cursor is generally used to store the collection of query results , especially the return value of the database's query method is the cursor object, and the cursor object holds the result of the query. Similar to iterator iterators.
Common methods:
Movetofirst ();//This method causes cursor cursors to point to the first row of the data record, which is used to iterate from the first line
MoveToNext ();//Determine if the next row has a record, and then point to the next line.
Xxxx getxxxx(int columnindex);//Based on columnindex, gets the value of XXX data type,
int Getcolumnindexorthrow (String columnName)//gets its index value based on the column name
Note: You can use the activity's Startmanagingcursor (cursor) method to manage the life cycle of the created cursor so that it is easy to reclaim and destroy the cursor.
Case:
XXXX getxxxx (Getcolumnindexorthrow (String columnName));//based on the column name, gets the value (XXXX) on the column name on the table;
Traverse:
Cursor.movetofirst ()
while (Cursor.movetonext ())
{
Cursor.xxx ();//Traversal result set
}
2.public Abstract class CursorAdapter
Extends Baseadapter
Implements Filterable
Subclass is the following two sub-classes
When implementing CursorAdapter, you implement the following abstract methods:
     //Create a new View object@Override PublicView Newview (context context, cursor cursor, viewgroup parent) {View View=Super. Newview (context, cursor, parent); Tag Tag=NewTag (); Tag.icon=(ImageView) View.findviewbyid (R.id.book_icon); Tag.author=(TextView) View.findviewbyid (R.id.author); Tag.name=(TextView) View.findviewbyid (r.id.book_name); Tag.year=(TextView) View.findviewbyid (r.id.year);            View.settag (tag); returnview; }      //bind the data that the cursor points to and the View object that is created@Override Public voidBindView (view view, context context, cursor cursor) {tag tag=(TAG) View.gettag ();            Tag.author.setText (cursor.getstring (cursor. Getcolumnindexorthrow (Publisher.AUTHOR.NAME)));            Tag.name.setText (cursor.getstring (cursor. Getcolumnindexorthrow (Publisher.BOOK.NAME)));            Tag.year.setText (cursor.getstring (cursor. Getcolumnindexorthrow (Publisher.BOOK.PUBLISH_YEAR))); Bitmap icon=Bitmapfactory.decoderesource (Getresources (), R.drawable.icon);        Tag.icon.setImageBitmap (icon); }     //A collection of various UI components inside the view   classTag { PublicImageView icon;  PublicTextView name;  PublicTextView author;  PublicTextView Year; }
3.public Abstract class Resourcecursoradapter
Function: The cursor data is displayed on the view via the adapter
Resourcecursoradapter (context context, int layout, Cursor c)
4.public class Simplecursoradapter
Simplecursoradapter (context context, int layout, Cursor C, string[] from, int[] to)
The cursor and its adapter mode