CrossProcessCursor


public interface CrossProcessCursor
implements Cursor

android.database.CrossProcessCursor
AbstractCursor This is an abstract cursor class that handles a lot of the common code that all cursors need to deal with and is provided for convenience reasons. 
AbstractWindowedCursor A base class for Cursors that store their data in CursorWindows. 
CrossProcessCursorWrapper Cursor wrapper that implements CrossProcessCursor
MatrixCursor A mutable cursor implementation backed by an array of Objects. 
MergeCursor A convenience class that lets you present an array of Cursors as a single linear Cursor. 
SQLiteCursor A Cursor implementation that exposes results from a query on a SQLiteDatabase


A cross process cursor is an extension of a Cursor that also supports usage from remote processes.

The contents of a cross process cursor are marshalled to the remote process by filling CursorWindow objects using fillWindow(int, CursorWindow). As an optimization, the cursor can provide a pre-filled window to use via getWindow() thereby obviating the need to copy the data to yet another cursor window.

Summary

Inherited constants

int FIELD_TYPE_BLOB

Value returned by getType(int) if the specified column type is blob

int FIELD_TYPE_FLOAT

Value returned by getType(int) if the specified column type is float

int FIELD_TYPE_INTEGER

Value returned by getType(int) if the specified column type is integer

int FIELD_TYPE_NULL

Value returned by getType(int) if the specified column is null

int FIELD_TYPE_STRING

Value returned by getType(int) if the specified column type is string

Public methods

abstract void fillWindow(int position, CursorWindow window)

Copies cursor data into the window.

abstract CursorWindow getWindow()

Returns a pre-filled window that contains the data within this cursor.

abstract boolean onMove(int oldPosition, int newPosition)

This function is called every time the cursor is successfully scrolled to a new position, giving the subclass a chance to update any state it may have.

Inherited methods

abstract void close()

Closes the Cursor, releasing all of its resources and making it completely invalid.

abstract void copyStringToBuffer(int columnIndex, CharArrayBuffer buffer)

Retrieves the requested column text and stores it in the buffer provided.

abstract void deactivate()

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 int getColumnCount()

Return total number of columns

abstract int getColumnIndex(String columnName)

Returns the zero-based index for the given column name, or -1 if the column doesn't exist.

abstract int getColumnIndexOrThrow(String columnName)

Returns the zero-based index for the given column name, or throws IllegalArgumentException if the column doesn't exist.

abstract String getColumnName(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 int getCount()

Returns the numbers of rows in the cursor.

abstract double getDouble(int columnIndex)

Returns the value of the requested column as a double.

abstract Bundle getExtras()

Returns a bundle of extra values.

abstract float getFloat(int columnIndex)

Returns the value of the requested column as a float.

abstract int getInt(int columnIndex)

Returns the value of the requested column as an int.

abstract long getLong(int columnIndex)

Returns the value of the requested column as a long.

abstract Uri getNotificationUri()

Return the URI at which notifications of changes in this Cursor's data will be delivered, as previously set by setNotificationUri(ContentResolver, Uri).

default List<Uri> getNotificationUris()

Return the URIs at which notifications of changes in this Cursor's data will be delivered, as previously set by setNotificationUris(ContentResolver, List).

abstract int getPosition()

Returns the current position of the cursor in the row set.

abstract short getShort(int columnIndex)

Returns the value of the requested column as a short.

abstract String getString(int columnIndex)

Returns the value of the requested column as a String.

abstract int getType(int columnIndex)

Returns data type of the given column's value.

abstract boolean getWantsAllOnMoveCalls()

onMove() will only be called across processes if this method returns true.

abstract boolean isAfterLast()

Returns whether the cursor is pointing to the position after the last row.

abstract boolean isBeforeFirst()

Returns whether the cursor is pointing to the position before the first row.

abstract boolean isClosed()

return true if the cursor is closed

abstract boolean isFirst()

Returns whether the cursor is pointing to the first row.

abstract boolean isLast()

Returns whether the cursor is pointing to the last row.

abstract boolean isNull(int columnIndex)

Returns true if the value in the indicated column is null.

abstract boolean move(int offset)

Move the cursor by a relative amount, forward or backward, from the current position.

abstract boolean moveToFirst()

Move the cursor to the first row.

abstract boolean moveToLast()

Move the cursor to the last row.

abstract boolean moveToNext()

Move the cursor to the next row.

abstract boolean moveToPosition(int position)

Move the cursor to an absolute position.

abstract boolean moveToPrevious()

Move the cursor to the previous row.

abstract void registerContentObserver(ContentObserver observer)

Register an observer that is called when changes happen to the content backing this cursor.

abstract void registerDataSetObserver(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 boolean requery()

This method was deprecated in API level 15. 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 Bundle respond(Bundle extras)

This is an out-of-band way for the user of a cursor to communicate with the cursor.

abstract void setExtras(Bundle extras)

Sets a Bundle that will be returned by getExtras().

abstract void setNotificationUri(ContentResolver cr, Uri uri)

Register to watch a content URI for changes.

default void setNotificationUris(ContentResolver cr, List<Uri> uris)

Similar to setNotificationUri(android.content.ContentResolver, android.net.Uri), except this version allows to watch multiple content URIs for changes.

abstract void unregisterContentObserver(ContentObserver observer)

Unregister an observer that has previously been registered with this cursor via registerContentObserver(ContentObserver).

abstract void unregisterDataSetObserver(DataSetObserver observer)

Unregister an observer that has previously been registered with this cursor via registerContentObserver(ContentObserver).

abstract void close()

Closes this stream and releases any system resources associated with it.

abstract void close()

Closes this resource, relinquishing any underlying resources.

Public methods

fillWindow

Added in API level 1
public abstract void fillWindow (int position, 
                CursorWindow window)

Copies cursor data into the window.

Clears the window and fills it with data beginning at the requested row position until all of the data in the cursor is exhausted or the window runs out of space.

The filled window uses the same row indices as the original cursor. For example, if you fill a window starting from row 5 from the cursor, you can query the contents of row 5 from the window just by asking it for row 5 because there is a direct correspondence between the row indices used by the cursor and the window.

The current position of the cursor, as returned by Cursor.getPosition(), is not changed by this method.

Parameters
position int: The zero-based index of the first row to copy into the window.

window CursorWindow: The window to fill.

getWindow

Added in API level 1
public abstract CursorWindow getWindow ()

Returns a pre-filled window that contains the data within this cursor.

In particular, the window contains the row indicated by Cursor.getPosition. The window's contents are automatically scrolled whenever the current row moved outside the range covered by the window.

Returns
CursorWindow The pre-filled window, or null if none.

onMove

Added in API level 1
public abstract boolean onMove (int oldPosition, 
                int newPosition)

This function is called every time the cursor is successfully scrolled to a new position, giving the subclass a chance to update any state it may have. If it returns false the move function will also do so and the cursor will scroll to the beforeFirst position.

This function should be called by methods such as Cursor.moveToPosition(int), so it will typically not be called from outside of the cursor class itself.

Parameters
oldPosition int: The position that we're moving from.

newPosition int: The position that we're moving to.

Returns
boolean True if the move is successful, false otherwise.