[Android] Cursor


public interface

Cursor

implements Closeable

Class Overview


This interface provides random read-write access to the result set returned by a database query.
Cursor implementations are not required to be synchronized so code using a Cursor from multiple threads should perform its own synchronization when using the Cursor.
Implementations should subclass AbstractCursor.

Public Methods
abstract voidclose()
Closes the Cursor, releasing all of its resources and making it completely invalid.
abstract voidcopyStringToBuffer(int columnIndex, CharArrayBuffer buffer)
Retrieves the requested column text and stores it in the buffer provided.
abstract voiddeactivate()
This method was deprecated in API level 16. Since requery() is deprecated, so too is this.
abstract byte[]getBlob(int columnIndex)
Returns the value of the requested column as a byte array.
abstract intgetColumnCount()
Return total number of columns
abstract intgetColumnIndex(String columnName)
Returns the zero-based index for the given column name, or -1 if the column doesn't exist.
abstract intgetColumnIndexOrThrow(String columnName)
Returns the zero-based index for the given column name, or throws IllegalArgumentException if the column doesn't exist.
abstract StringgetColumnName(int columnIndex)
Returns the column name at the given zero-based column index.
abstract String[]getColumnNames()
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.
abstract intgetCount()
Returns the numbers of rows in the cursor.
abstract doublegetDouble(int columnIndex)
Returns the value of the requested column as a double.
abstract BundlegetExtras()
Returns a bundle of extra values.
abstract floatgetFloat(int columnIndex)
Returns the value of the requested column as a float.
abstract intgetInt(int columnIndex)
Returns the value of the requested column as an int.
abstract longgetLong(int columnIndex)
Returns the value of the requested column as a long.
abstract UrigetNotificationUri()
Return the URI at which notifications of changes in this Cursor's data will be delivered, as previously set bysetNotificationUri(ContentResolver, Uri).
abstract intgetPosition()
Returns the current position of the cursor in the row set.
abstract shortgetShort(int columnIndex)
Returns the value of the requested column as a short.
abstract StringgetString(int columnIndex)
Returns the value of the requested column as a String.
abstract intgetType(int columnIndex)
Returns data type of the given column's value.
abstract booleangetWantsAllOnMoveCalls()
onMove() will only be called across processes if this method returns true.
abstract booleanisAfterLast()
Returns whether the cursor is pointing to the position after the last row.
abstract booleanisBeforeFirst()
Returns whether the cursor is pointing to the position before the first row.
abstract booleanisClosed()
return true if the cursor is closed
abstract booleanisFirst()
Returns whether the cursor is pointing to the first row.
abstract booleanisLast()
Returns whether the cursor is pointing to the last row.
abstract booleanisNull(int columnIndex)
Returns true if the value in the indicated column is null.
abstract booleanmove(int offset)
Move the cursor by a relative amount, forward or backward, from the current position.
abstract booleanmoveToFirst()
Move the cursor to the first row.
abstract booleanmoveToLast()
Move the cursor to the last row.
abstract booleanmoveToNext()
Move the cursor to the next row.
abstract booleanmoveToPosition(int position)
Move the cursor to an absolute position.
abstract booleanmoveToPrevious()
Move the cursor to the previous row.
abstract voidregisterContentObserver(ContentObserver observer)
Register an observer that is called when changes happen to the content backing this cursor.
abstract voidregisterDataSetObserver(DataSetObserver observer)
Register an observer that is called when changes happen to the contents of the this cursors data set, for example, when the data set is changed via requery()deactivate(), or close().
abstract booleanrequery()
This method was deprecated in API level 11. Don't use this. Just request a new cursor, so you can do this asynchronously and update your list view once the new cursor comes back.
abstract Bundlerespond(Bundle extras)
This is an out-of-band way for the the user of a cursor to communicate with the cursor.
abstract voidsetNotificationUri(ContentResolver cr, Uri uri)
Register to watch a content URI for changes.
abstract voidunregisterContentObserver(ContentObserver observer)
Unregister an observer that has previously been registered with this cursor via registerContentObserver(ContentObserver).
abstract voidunregisterDataSetObserver(DataSetObserver observer)
Unregister an observer that has previously been registered with this cursor via registerContentObserver(ContentObserver).

沒有留言:

張貼留言