AbstractCursor
abstract class AbstractCursor : CrossProcessCursor
Known Indirect Subclasses
|
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.
|
Protected methods |
open Unit |
This function throws CursorIndexOutOfBoundsException if the cursor position is out of bounds.
|
open Unit |
|
open Any! |
|
open Boolean |
|
open Unit |
Subclasses must call this method when they finish committing updates to notify all observers.
|
Public constructors
AbstractCursor
AbstractCursor()
Public methods
close
open fun close(): Unit
Exceptions |
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
copyStringToBuffer
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
open fun deactivate(): Unit
fillWindow
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
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
open fun getColumnCount(): Int
Return |
Int |
number of columns Value is 0 or greater |
getColumnIndex
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
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
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
abstract fun getColumnNames(): Array<String!>!
Return |
Array<String!>! |
the names of the columns returned in this query. |
getCount
abstract fun getCount(): Int
Return |
Int |
the number of rows in the cursor. Value is 0 or greater |
getDouble
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. |
getFloat
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
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
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
open fun getNotificationUri(): Uri!
getNotificationUris
open fun getNotificationUris(): MutableList<Uri!>?
getPosition
fun getPosition(): Int
Return |
Int |
the current cursor position. Value is -1 or greater |
getShort
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
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
open fun getType(column: Int): Int
Parameters |
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
getWantsAllOnMoveCalls
open fun getWantsAllOnMoveCalls(): Boolean
Return |
Boolean |
whether all cursor movement should result in a call to onMove(). |
getWindow
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
fun isAfterLast(): Boolean
Return |
Boolean |
whether the cursor is after the last result. |
isBeforeFirst
fun isBeforeFirst(): Boolean
Return |
Boolean |
whether the cursor is before the first result. |
isClosed
open fun isClosed(): Boolean
Return |
Boolean |
true if the cursor is closed. |
isFirst
fun isFirst(): Boolean
Return |
Boolean |
whether the cursor is pointing at the first entry. |
isLast
fun isLast(): Boolean
Return |
Boolean |
whether the cursor is pointing at the last entry. |
isNull
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
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
fun moveToFirst(): Boolean
Return |
Boolean |
whether the move succeeded. |
moveToLast
fun moveToLast(): Boolean
Return |
Boolean |
whether the move succeeded. |
moveToNext
fun moveToNext(): Boolean
Return |
Boolean |
whether the move succeeded. |
moveToPosition
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
fun moveToPrevious(): Boolean
Return |
Boolean |
whether the move succeeded. |
onMove
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
open fun registerContentObserver(observer: ContentObserver!): Unit
Parameters |
observer |
ContentObserver!: the object that gets notified when the content backing the cursor changes. |
registerDataSetObserver
open fun registerDataSetObserver(observer: DataSetObserver!): Unit
Parameters |
observer |
DataSetObserver!: the object that gets notified when the cursors data set changes. |
requery
open fun requery(): Boolean
Return |
Boolean |
true if the requery succeeded, false if not, in which case the cursor becomes invalid. |
open fun setExtras(extras: Bundle!): Unit
Parameters |
extras |
Bundle!: Bundle to set, or null to set an empty bundle. |
setNotificationUri
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. |
Protected methods
checkPosition
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
protected open fun finalize(): Unit
Exceptions |
java.lang.Throwable |
the Exception raised by this method |
getUpdatedField
protected open fun getUpdatedField(columnIndex: Int): Any!
Deprecated: Always returns null since Cursors do not support updating rows
isFieldUpdated
protected open fun isFieldUpdated(columnIndex: Int): Boolean
Deprecated: Always returns false since Cursors do not support updating rows
onChange
protected open fun onChange(selfChange: Boolean): Unit
Subclasses must call this method when they finish committing updates to notify all observers.
Properties
mContentResolver
protected var mContentResolver: ContentResolver!
Deprecated: Do not use.