MergeCursor
open class MergeCursor : AbstractCursor
| kotlin.Any | ||
| ↳ | android.database.AbstractCursor | |
| ↳ | android.database.MergeCursor | |
A convenience class that lets you present an array of Cursors as a single linear Cursor. The schema of the cursors presented is entirely up to the creator of the MergeCursor, and may be different if that is desired. Calls to getColumns, getColumnIndex, etc will return the value for the row that the MergeCursor is currently pointing at.
Summary
| Public constructors | |
|---|---|
MergeCursor(cursors: Array<Cursor!>!) |
|
| Public methods | |
|---|---|
| open Unit |
close()Closes the Cursor, releasing all of its resources and making it completely invalid. |
| open Unit |
Deactivates the Cursor, making all calls on it fail until |
| open ByteArray! |
Returns the value of the requested column as a byte array. |
| open Array<String!>! |
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result. |
| open Int |
getCount()Returns the numbers of rows in the cursor. |
| open Double |
Returns the value of the requested column as a double. |
| open Float |
Returns the value of the requested column as a float. |
| open Int |
Returns the value of the requested column as an int. |
| open Long |
Returns the value of the requested column as a long. |
| open Short |
Returns the value of the requested column as a short. |
| open String! |
Returns the value of the requested column as a String. |
| open Int |
Returns data type of the given column's value. |
| open Boolean |
Returns |
| open 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. |
| open Unit |
registerContentObserver(observer: ContentObserver!)Register an observer that is called when changes happen to the content backing this cursor. |
| open Unit |
registerDataSetObserver(observer: DataSetObserver!)Register an observer that is called when changes happen to the contents of the this cursors data set, for example, when the data set is changed via |
| open Boolean |
requery()Performs the query that created the cursor again, refreshing its contents. |
| open Unit |
unregisterContentObserver(observer: ContentObserver!)Unregister an observer that has previously been registered with this cursor via |
| open Unit |
unregisterDataSetObserver(observer: DataSetObserver!)Unregister an observer that has previously been registered with this cursor via |
| Inherited functions | |
|---|---|
| Inherited properties | |
|---|---|
Public constructors
Public methods
close
open fun close(): Unit
Closes the Cursor, releasing all of its resources and making it completely invalid. Unlike deactivate() a call to requery() will not make the Cursor valid again.
| Exceptions | |
|---|---|
java.lang.Exception |
if this resource cannot be closed |
java.io.IOException |
if an I/O error occurs |
deactivate
open fun deactivate(): Unit
Deactivates the Cursor, making all calls on it fail until requery is called. Inactive Cursors use fewer resources than active Cursors. Calling requery will make the cursor active again.
getBlob
open fun getBlob(column: Int): ByteArray!
Returns the value of the requested column as a byte array.
The result and whether this method throws an exception when the column value is null or the column type is not a blob type is implementation-defined.
| 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. |
getColumnNames
open fun getColumnNames(): Array<String!>!
Returns a string array holding the names of all of the columns in the result set in the order in which they were listed in the result.
| Return | |
|---|---|
Array<String!>! |
the names of the columns returned in this query. |
getCount
open fun getCount(): Int
Returns the numbers of rows in the cursor.
| Return | |
|---|---|
Int |
the number of rows in the cursor. Value is 0 or greater |
getDouble
open fun getDouble(column: Int): Double
Returns the value of the requested column as a double.
The result and whether this method throws an exception when the column value is null, the column type is not a floating-point type, or the floating-point value is not representable as a double value is implementation-defined.
| 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
open fun getFloat(column: Int): Float
Returns the value of the requested column as a float.
The result and whether this method throws an exception when the column value is null, the column type is not a floating-point type, or the floating-point value is not representable as a float value is implementation-defined.
| 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
open fun getInt(column: Int): Int
Returns the value of the requested column as an int.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Integer.MIN_VALUE, Integer.MAX_VALUE] is implementation-defined.
| 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
open fun getLong(column: Int): Long
Returns the value of the requested column as a long.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Long.MIN_VALUE, Long.MAX_VALUE] is implementation-defined.
| 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. |
getShort
open fun getShort(column: Int): Short
Returns the value of the requested column as a short.
The result and whether this method throws an exception when the column value is null, the column type is not an integral type, or the integer value is outside the range [Short.MIN_VALUE, Short.MAX_VALUE] is implementation-defined.
| 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
open fun getString(column: Int): String!
Returns the value of the requested column as a String.
The result and whether this method throws an exception when the column value is null or the column type is not a string type is implementation-defined.
| 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
Returns data type of the given column's value. The preferred type of the column is returned but the data may be converted to other types as documented in the get-type methods such as getInt(int), getFloat(int) etc.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Int |
column value type. Value is one of the following: |
isNull
open fun isNull(column: Int): Boolean
Returns true if the value in the indicated column is null.
| Parameters | |
|---|---|
columnIndex |
the zero-based index of the target column. Value is 0 or greater |
| Return | |
|---|---|
Boolean |
whether the column value is null. |
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
Register an observer that is called when changes happen to the content backing this cursor. Typically the data set won't change until requery() is called.
| Parameters | |
|---|---|
observer |
ContentObserver!: the object that gets notified when the content backing the cursor changes. |
registerDataSetObserver
open fun registerDataSetObserver(observer: DataSetObserver!): Unit
Register an observer that is called when changes happen to the contents of the this cursors data set, for example, when the data set is changed via requery(), deactivate(), or #close().
| Parameters | |
|---|---|
observer |
DataSetObserver!: the object that gets notified when the cursors data set changes. |
requery
open fun requery(): Boolean
Performs the query that created the cursor again, refreshing its contents. This may be done at any time, including after a call to deactivate. Since this method could execute a query on the database and potentially take a while, it could cause ANR if it is called on Main (UI) thread. A warning is printed if this method is being executed on Main thread.
| Return | |
|---|---|
Boolean |
true if the requery succeeded, false if not, in which case the cursor becomes invalid. |
unregisterContentObserver
open fun unregisterContentObserver(observer: ContentObserver!): Unit
Unregister an observer that has previously been registered with this cursor via registerContentObserver.
| Parameters | |
|---|---|
observer |
ContentObserver!: the object to unregister. |
unregisterDataSetObserver
open fun unregisterDataSetObserver(observer: DataSetObserver!): Unit
Unregister an observer that has previously been registered with this cursor via registerContentObserver.
| Parameters | |
|---|---|
observer |
DataSetObserver!: the object to unregister. |