Added in API level 8
Deprecated in API level 24

MockCursor


open class MockCursor : Cursor
kotlin.Any
   ↳ android.test.mock.MockCursor

A mock android.database.Cursor class that isolates the test code from real Cursor implementation.

All methods including ones related to querying the state of the cursor are are non-functional and throw java.lang.UnsupportedOperationException.

Summary

Inherited constants
Public constructors

Public methods
open Unit

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

open Unit

open ByteArray!
getBlob(columnIndex: Int)

open Int

open Int
getColumnIndex(columnName: String!)

open Int

open String!
getColumnName(columnIndex: Int)

open Array<String!>!

open Int

open Double
getDouble(columnIndex: Int)

open Bundle!

open Float
getFloat(columnIndex: Int)

open Int
getInt(columnIndex: Int)

open Long
getLong(columnIndex: Int)

open Uri!

open MutableList<Uri!>?

open Int

open Short
getShort(columnIndex: Int)

open String!
getString(columnIndex: Int)

open Int
getType(columnIndex: Int)

open Boolean

open Boolean

open Boolean

open Boolean

open Boolean

open Boolean

open Boolean
isNull(columnIndex: Int)

open Boolean
move(offset: Int)

open Boolean

open Boolean

open Boolean

open Boolean
moveToPosition(position: Int)

open Boolean

open Unit

open Unit

open Boolean

open Bundle!
respond(extras: Bundle!)

open Unit
setExtras(extras: Bundle!)

open Unit

open Unit

open Unit

open Unit

Public constructors

MockCursor

MockCursor()

Public methods

close

Added in API level 8
open fun close(): Unit

Deprecated: Deprecated in Java.

Exceptions
java.lang.Exception if this resource cannot be closed
java.io.IOException if an I/O error occurs

copyStringToBuffer

Added in API level 8
open fun copyStringToBuffer(
    columnIndex: Int,
    buffer: CharArrayBuffer!
): Unit

Deprecated: Deprecated in Java.

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 8
open fun deactivate(): Unit

Deprecated: Deprecated in Java.

getBlob

Added in API level 8
open fun getBlob(columnIndex: Int): ByteArray!

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getColumnCount(): Int

Deprecated: Deprecated in Java.

Return
Int number of columns Value is 0 or greater

getColumnIndex

Added in API level 8
open fun getColumnIndex(columnName: String!): Int

Deprecated: Deprecated in Java.

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 8
open fun getColumnIndexOrThrow(columnName: String!): Int

Deprecated: Deprecated in Java.

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 8
open fun getColumnName(columnIndex: Int): String!

Deprecated: Deprecated in Java.

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 8
open fun getColumnNames(): Array<String!>!

Deprecated: Deprecated in Java.

Return
Array<String!>! the names of the columns returned in this query.

getCount

Added in API level 8
open fun getCount(): Int

Deprecated: Deprecated in Java.

Return
Int the number of rows in the cursor. Value is 0 or greater

getDouble

Added in API level 8
open fun getDouble(columnIndex: Int): Double

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getExtras(): Bundle!

Deprecated: Deprecated in Java.

Return
Bundle! cursor-defined values, or Bundle.EMPTY if there are no values. Never null.

getFloat

Added in API level 8
open fun getFloat(columnIndex: Int): Float

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getInt(columnIndex: Int): Int

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getLong(columnIndex: Int): Long

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 19
Deprecated in API level 24
open fun getNotificationUri(): Uri!

Deprecated: Deprecated in Java.

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
Deprecated in API level 24
open fun getNotificationUris(): MutableList<Uri!>?

Deprecated: Deprecated in Java.

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 8
open fun getPosition(): Int

Deprecated: Deprecated in Java.

Return
Int the current cursor position. Value is -1 or greater

getShort

Added in API level 8
open fun getShort(columnIndex: Int): Short

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getString(columnIndex: Int): String!

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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
Deprecated in API level 24
open fun getType(columnIndex: Int): Int

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun getWantsAllOnMoveCalls(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether all cursor movement should result in a call to onMove().

isAfterLast

Added in API level 8
open fun isAfterLast(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the cursor is after the last result.

isBeforeFirst

Added in API level 8
open fun isBeforeFirst(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the cursor is before the first result.

isClosed

Added in API level 8
open fun isClosed(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean true if the cursor is closed.

isFirst

Added in API level 8
open fun isFirst(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the cursor is pointing at the first entry.

isLast

Added in API level 8
open fun isLast(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the cursor is pointing at the last entry.

isNull

Added in API level 8
open fun isNull(columnIndex: Int): Boolean

Deprecated: Deprecated in Java.

Parameters
columnIndex Int: 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 8
open fun move(offset: Int): Boolean

Deprecated: Deprecated in Java.

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 8
open fun moveToFirst(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the move succeeded.

moveToLast

Added in API level 8
open fun moveToLast(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the move succeeded.

moveToNext

Added in API level 8
open fun moveToNext(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the move succeeded.

moveToPosition

Added in API level 8
open fun moveToPosition(position: Int): Boolean

Deprecated: Deprecated in Java.

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 8
open fun moveToPrevious(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean whether the move succeeded.

registerContentObserver

Added in API level 8
open fun registerContentObserver(observer: ContentObserver!): Unit

Deprecated: Deprecated in Java.

Parameters
observer ContentObserver!: the object that gets notified when the content backing the cursor changes.

registerDataSetObserver

Added in API level 8
open fun registerDataSetObserver(observer: DataSetObserver!): Unit

Deprecated: Deprecated in Java.

Parameters
observer DataSetObserver!: the object that gets notified when the cursors data set changes.

requery

Added in API level 8
open fun requery(): Boolean

Deprecated: Deprecated in Java.

Return
Boolean true if the requery succeeded, false if not, in which case the cursor becomes invalid.

respond

Added in API level 8
open fun respond(extras: Bundle!): Bundle!

Deprecated: Deprecated in Java.

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
Deprecated in API level 24
open fun setExtras(extras: Bundle!): Unit

Deprecated: Deprecated in Java.

Parameters
extras Bundle!: Bundle to set, or null to set an empty bundle.

setNotificationUri

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

Deprecated: Deprecated in Java.

Parameters
cr ContentResolver!: The content resolver from the caller's context. The listener attached to this resolver will be notified.
uri Uri!: The content URI to watch.

setNotificationUris

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

Deprecated: Deprecated in Java.

Parameters
cr ContentResolver: The content resolver from the caller's context. The listener attached to this resolver will be notified. This value cannot be null.
uris MutableList<Uri!>: The content URIs to watch. This value cannot be null.

unregisterContentObserver

Added in API level 8
open fun unregisterContentObserver(observer: ContentObserver!): Unit

Deprecated: Deprecated in Java.

Parameters
observer ContentObserver!: the object to unregister.

unregisterDataSetObserver

Added in API level 8
open fun unregisterDataSetObserver(observer: DataSetObserver!): Unit

Deprecated: Deprecated in Java.

Parameters
observer DataSetObserver!: the object to unregister.