75 CHAPTER 6: Content Providers A Cursor Class Based on the Cursor Interface
A more low-level approach of implementing a cursor is not relying on AbstractCursor but
instead implementing all the interface methods yourself.
You can then use subclassing as in class MyCursor : Cursor { ... } or use an anonymous
object as in val myCursor = object : Cursor { ... }. The section “Cursor Interface” in the
online text companion describes all the interface methods.
Table 6-2.More Cursor Implementations Name Inside android.database Description AbstractWindowedCursor
This inherits from AbstractCursor and owns a CursorWindow
object holding the data. Subclasses are responsible for filling
the cursor window with data during their onMove(Int, Int)
operation, allocating a new cursor window if necessary. It’s
easier to implement compared to AbstractCursor, but you have
to add a lot of functionality to onMove().
CrossProcessCursor
This is a cursor implementation that allows using it from
remote processes. It is just an extension of the android.
database.Cursor interface, containing three more methods:
fillWindow(Int, CursorWindow), getWindow(): CursorWindow,
and onMove(Int, Int): Boolean. It does not provide any own
implementation; you have to overwrite all the methods defined
in Cursor.
CrossProcessCursorWrapper
This is a cursor implementation that allows using it from remote
processes. It implements CrossProcessCursor and holds a
Cursor delegate, which can also be a CrossProcessCursor.
CursorWrapper
This holds a Cursor delegate that all method calls are
forwarded to.
MatrixCursor
This is a full implementation of Cursor, with in-memory storage
of data as an Object array. You have to use addRow(...) to add
data. The inner class MatrixCursor.RowBuilder can be used to
build rows to be used by MatrixCursor.addRow(Array