core-ktx / androidx.database / android.database.Cursor

Extensions for android.database.Cursor

getBlob

fun Cursor.getBlob(columnName: String): ByteArray

Returns the value of the requested column as a byte array.

getBlobOrNull

fun Cursor.getBlobOrNull(index: Int): ByteArray?
fun Cursor.getBlobOrNull(columnName: String): ByteArray?

Returns the value of the requested column as a nullable byte array.

getDouble

fun Cursor.getDouble(columnName: String): Double

Returns the value of the requested column as a double.

getDoubleOrNull

fun Cursor.getDoubleOrNull(index: Int): Double?
fun Cursor.getDoubleOrNull(columnName: String): Double?

Returns the value of the requested column as a nullable double.

getFloat

fun Cursor.getFloat(columnName: String): Float

Returns the value of the requested column as a float.

getFloatOrNull

fun Cursor.getFloatOrNull(index: Int): Float?
fun Cursor.getFloatOrNull(columnName: String): Float?

Returns the value of the requested column as a nullable float.

getInt

fun Cursor.getInt(columnName: String): Int

Returns the value of the requested column as an integer.

getIntOrNull

fun Cursor.getIntOrNull(index: Int): Int?
fun Cursor.getIntOrNull(columnName: String): Int?

Returns the value of the requested column as a nullable integer.

getLong

fun Cursor.getLong(columnName: String): Long

Returns the value of the requested column as a long.

getLongOrNull

fun Cursor.getLongOrNull(index: Int): Long?
fun Cursor.getLongOrNull(columnName: String): Long?

Returns the value of the requested column as a nullable long.

getShort

fun Cursor.getShort(columnName: String): Short

Returns the value of the requested column as a short.

getShortOrNull

fun Cursor.getShortOrNull(index: Int): Short?
fun Cursor.getShortOrNull(columnName: String): Short?

Returns the value of the requested column as a nullable short.

getString

fun Cursor.getString(columnName: String): String

Returns the value of the requested column as a string.

getStringOrNull

fun Cursor.getStringOrNull(index: Int): String?
fun Cursor.getStringOrNull(columnName: String): String?

Returns the value of the requested column as a nullable string.