Added in API level 1

AbstractCursor


abstract class AbstractCursor : CrossProcessCursor
kotlin.Any
   ↳ android.database.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.

Summary

Nested classes
open

Cursors use this class to track changes others make to their URI.

Public constructors

Public methods
open Unit

open Unit
copyStringToBuffer(columnIndex: Int, buffer: CharArrayBuffer!)

open Unit

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

open ByteArray!
getBlob(column: Int)

open Int

open Int
getColumnIndex(columnName: String!)

open Int

open String!
getColumnName(columnIndex: Int)

abstract Array<String!>!

abstract Int

abstract Double
getDouble(column: Int)

open Bundle!

abstract Float
getFloat(column: Int)

abstract Int
getInt(column: Int)

abstract Long
getLong(column: Int)

open Uri!

open MutableList<Uri!>?

Int

abstract Short
getShort(column: Int)

abstract String!
getString(column: Int)

open Int
getType(column: Int)

open Boolean

open CursorWindow!

If the cursor is backed by a CursorWindow, returns a pre-filled window with the contents of the cursor, otherwise null.

Boolean

Boolean

open Boolean

Boolean

Boolean

abstract Boolean
isNull(column: Int)

Boolean
move(offset: Int)

Boolean

Boolean

Boolean

Boolean
moveToPosition(position: Int)

Boolean

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.

open Unit

open Unit

open Boolean

open Bundle!
respond(extras: Bundle!)

open Unit
setExtras(extras: Bundle!)

open Unit

Specifies a content URI to watch for changes.

open Unit

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

open Unit

open Unit

Protected methods
open Unit

This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds.

open Unit

open Any!
getUpdatedField(columnIndex: Int)

open Boolean
isFieldUpdated(columnIndex: Int)

open Unit
onChange(selfChange: Boolean)

Subclasses must call this method when they finish committing updates to notify all observers.

Properties
Boolean

ContentResolver!

Int

Public constructors

AbstractCursor

Added in API level 1
AbstractCursor()

Public methods

close

Added in API level 1
open fun close(): Unit
Exceptions
java.lang.Exception if this resource cannot be closed
java.io.IOException if an I/O error occurs

copyStringToBuffer

Added in API level 1
open fun copyStringToBuffer(
    columnIndex: Int,
    buffer: CharArrayBuffer!
): Unit
Parameters
columnIndex Int: the zero-based index of the target column. if the target column is null, return buffer Value is 0 or greater
buffer CharArrayBuffer!: the buffer to copy the text into.

deactivate

Added in API level 1
open fun deactivate(): Unit

fillWindow

Added in API level 1
open fun fillWindow(
    position: Int,
    window: CursorWindow!
): Unit
Parameters
position Int: The zero-based index of the first row to copy into the window.
window CursorWindow!: The window to fill.

getBlob

Added in API level 1
open fun getBlob(column: Int): ByteArray!
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
ByteArray! the value of that column as a byte array.

getColumnCount

Added in API level 1
open fun getColumnCount(): Int
Return
Int number of columns Value is 0 or greater

getColumnIndex

Added in API level 1
open fun getColumnIndex(columnName: String!): Int
Parameters
columnName String!: the name of the target column.
Return
Int the zero-based column index for the given column name, or -1 if the column name does not exist. Value is -1 or greater

getColumnIndexOrThrow

Added in API level 1
open fun getColumnIndexOrThrow(columnName: String!): Int
Parameters
columnName String!: the name of the target column.
Return
Int the zero-based column index for the given column name Value is 0 or greater
Exceptions
java.lang.IllegalArgumentException if the column does not exist

getColumnName

Added in API level 1
open fun getColumnName(columnIndex: Int): String!
Parameters
columnIndex Int: the zero-based index of the target column. Value is 0 or greater
Return
String! the column name for the given column index.

getColumnNames

Added in API level 1
abstract fun getColumnNames(): Array<String!>!
Return
Array<String!>! the names of the columns returned in this query.

getCount

Added in API level 1
abstract fun getCount(): Int
Return
Int the number of rows in the cursor. Value is 0 or greater

getDouble

Added in API level 1
abstract fun getDouble(column: Int): Double
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Double the value of that column as a double.

getExtras

Added in API level 1
open fun getExtras(): Bundle!
Return
Bundle! cursor-defined values, or Bundle.EMPTY if there are no values. Never null.

getFloat

Added in API level 1
abstract fun getFloat(column: Int): Float
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Float the value of that column as a float.

getInt

Added in API level 1
abstract fun getInt(column: Int): Int
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Int the value of that column as an int.

getLong

Added in API level 1
abstract fun getLong(column: Int): Long
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Long the value of that column as a long.

getNotificationUri

Added in API level 11
open fun getNotificationUri(): Uri!
Return
Uri! Returns a URI that can be used with ContentResolver.registerContentObserver to find out about changes to this Cursor's data. May be null if no notification URI has been set.

getNotificationUris

Added in API level 29
open fun getNotificationUris(): MutableList<Uri!>?
Return
MutableList<Uri!>? Returns URIs that can be used with ContentResolver.registerContentObserver to find out about changes to this Cursor's data. May be null if no notification URI has been set.

getPosition

Added in API level 1
fun getPosition(): Int
Return
Int the current cursor position. Value is -1 or greater

getShort

Added in API level 1
abstract fun getShort(column: Int): Short
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Short the value of that column as a short.

getString

Added in API level 1
abstract fun getString(column: Int): String!
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
String! the value of that column as a String.

getType

Added in API level 11
open fun getType(column: Int): Int
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Int column value type Value is android.database.Cursor#FIELD_TYPE_NULL, android.database.Cursor#FIELD_TYPE_INTEGER, android.database.Cursor#FIELD_TYPE_FLOAT, android.database.Cursor#FIELD_TYPE_STRING, or android.database.Cursor#FIELD_TYPE_BLOB

getWantsAllOnMoveCalls

Added in API level 1
open fun getWantsAllOnMoveCalls(): Boolean
Return
Boolean whether all cursor movement should result in a call to onMove().

getWindow

Added in API level 1
open fun getWindow(): CursorWindow!

If the cursor is backed by a CursorWindow, returns a pre-filled window with the contents of the cursor, otherwise null.

Return
CursorWindow! The pre-filled window that backs this cursor, or null if none.

isAfterLast

Added in API level 1
fun isAfterLast(): Boolean
Return
Boolean whether the cursor is after the last result.

isBeforeFirst

Added in API level 1
fun isBeforeFirst(): Boolean
Return
Boolean whether the cursor is before the first result.

isClosed

Added in API level 1
open fun isClosed(): Boolean
Return
Boolean true if the cursor is closed.

isFirst

Added in API level 1
fun isFirst(): Boolean
Return
Boolean whether the cursor is pointing at the first entry.

isLast

Added in API level 1
fun isLast(): Boolean
Return
Boolean whether the cursor is pointing at the last entry.

isNull

Added in API level 1
abstract fun isNull(column: Int): Boolean
Parameters
columnIndex the zero-based index of the target column. Value is 0 or greater
Return
Boolean whether the column value is null.

move

Added in API level 1
fun move(offset: Int): Boolean
Parameters
offset Int: the offset to be applied from the current position.
Return
Boolean whether the requested move fully succeeded.

moveToFirst

Added in API level 1
fun moveToFirst(): Boolean
Return
Boolean whether the move succeeded.

moveToLast

Added in API level 1
fun moveToLast(): Boolean
Return
Boolean whether the move succeeded.

moveToNext

Added in API level 1
fun moveToNext(): Boolean
Return
Boolean whether the move succeeded.

moveToPosition

Added in API level 1
fun moveToPosition(position: Int): Boolean
Parameters
position Int: the zero-based position to move to. Value is -1 or greater
Return
Boolean whether the requested move fully succeeded.

moveToPrevious

Added in API level 1
fun moveToPrevious(): Boolean
Return
Boolean whether the move succeeded.

onMove

Added in API level 1
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.

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

registerContentObserver

Added in API level 1
open fun registerContentObserver(observer: ContentObserver!): Unit
Parameters
observer ContentObserver!: the object that gets notified when the content backing the cursor changes.

registerDataSetObserver

Added in API level 1
open fun registerDataSetObserver(observer: DataSetObserver!): Unit
Parameters
observer DataSetObserver!: the object that gets notified when the cursors data set changes.

requery

Added in API level 1
open fun requery(): Boolean
Return
Boolean true if the requery succeeded, false if not, in which case the cursor becomes invalid.

respond

Added in API level 1
open fun respond(extras: Bundle!): Bundle!
Parameters
extras Bundle!: extra values, or Bundle.EMPTY. Never null.
Return
Bundle! extra values, or Bundle.EMPTY. Never null.

setExtras

Added in API level 23
open fun setExtras(extras: Bundle!): Unit
Parameters
extras Bundle!: Bundle to set, or null to set an empty bundle.

setNotificationUri

Added in API level 1
open fun setNotificationUri(
    cr: ContentResolver!,
    notifyUri: Uri!
): Unit

Specifies a content URI to watch for changes.

Parameters
cr ContentResolver!: The content resolver from the caller's context.
uri The content URI to watch.
notifyUri Uri!: The URI to watch for changes. This can be a specific row URI, or a base URI for a whole class of content.

setNotificationUris

Added in API level 29
open fun setNotificationUris(
    cr: ContentResolver,
    notifyUris: MutableList<Uri!>
): Unit

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

If this is not implemented, this is equivalent to calling setNotificationUri(android.content.ContentResolver,android.net.Uri) with the first URI in uris.

Calling this overrides any previous call to setNotificationUri(android.content.ContentResolver,android.net.Uri).

Parameters
cr ContentResolver: This value cannot be null.
uris The content URIs to watch. This value cannot be null.
notifyUris MutableList<Uri!>: This value cannot be null.

unregisterContentObserver

Added in API level 1
open fun unregisterContentObserver(observer: ContentObserver!): Unit
Parameters
observer ContentObserver!: the object to unregister.

unregisterDataSetObserver

Added in API level 1
open fun unregisterDataSetObserver(observer: DataSetObserver!): Unit
Parameters
observer DataSetObserver!: the object to unregister.

Protected methods

checkPosition

Added in API level 1
protected open fun checkPosition(): Unit

This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds. Subclass implementations of the get functions should call this before attempting to retrieve data.

Exceptions
android.database.CursorIndexOutOfBoundsException

finalize

Added in API level 1
protected open fun finalize(): Unit
Exceptions
java.lang.Throwable the Exception raised by this method

getUpdatedField

Added in API level 1
Deprecated in API level 15
protected open fun getUpdatedField(columnIndex: Int): Any!

Deprecated: Always returns null since Cursors do not support updating rows

isFieldUpdated

Added in API level 1
Deprecated in API level 15
protected open fun isFieldUpdated(columnIndex: Int): Boolean

Deprecated: Always returns false since Cursors do not support updating rows

onChange

Added in API level 1
protected open fun onChange(selfChange: Boolean): Unit

Subclasses must call this method when they finish committing updates to notify all observers.

Parameters
selfChange Boolean:

Properties

mClosed

Added in API level 1
Deprecated in API level 23
protected var mClosed: Boolean

Deprecated: Use isClosed() instead.

mContentResolver

Added in API level 1
Deprecated in API level 23
protected var mContentResolver: ContentResolver!

Deprecated: Do not use.

mPos

Added in API level 1
Deprecated in API level 23
protected var mPos: Int

Deprecated: Use getPosition() instead.