Added in API level 15

CrossProcessCursorWrapper


open class CrossProcessCursorWrapper : CursorWrapper, CrossProcessCursor
kotlin.Any
   ↳ android.database.CursorWrapper
   ↳ android.database.CrossProcessCursorWrapper

Cursor wrapper that implements CrossProcessCursor.

If the wrapped cursor implements CrossProcessCursor, then the wrapper delegates fillWindow, getWindow() and onMove to it. Otherwise, the wrapper provides default implementations of these methods that traverse the contents of the cursor similar to AbstractCursor.fillWindow.

This wrapper can be used to adapt an ordinary Cursor into a CrossProcessCursor.

Summary

Inherited constants
Public constructors

Creates a cross process cursor wrapper.

Public methods
open Unit
fillWindow(position: Int, window: CursorWindow!)

Copies cursor data into the window.

open CursorWindow!

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

open Boolean
onMove(oldPosition: Int, newPosition: Int)

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 functions

Public constructors

CrossProcessCursorWrapper

Added in API level 15
CrossProcessCursorWrapper(cursor: Cursor!)

Creates a cross process cursor wrapper.

Parameters
cursor Cursor!: The underlying cursor to wrap.

Public methods

fillWindow

Added in API level 15
open fun fillWindow(
    position: Int,
    window: CursorWindow!
): Unit

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 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 15
open fun getWindow(): CursorWindow!

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.

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

onMove

Added in API level 15
open fun onMove(
    oldPosition: Int,
    newPosition: Int
): Boolean

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 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.
Return
Boolean True if the move is successful, false otherwise.