Added in API level 1

ContentQueryMap


open class ContentQueryMap : Observable
kotlin.Any
   ↳ java.util.Observable
   ↳ android.content.ContentQueryMap

Caches the contents of a cursor into a Map of String->ContentValues and optionally keeps the cache fresh by registering for updates on the content backing the cursor. The column of the database that is to be used as the key of the map is user-configurable, and the ContentValues contains all columns other than the one that is designated the key.

The cursor data is accessed by row key and column name via getValue().

Summary

Public constructors
ContentQueryMap(cursor: Cursor!, columnNameOfKey: String!, keepUpdated: Boolean, handlerForUpdateNotifications: Handler!)

Creates a ContentQueryMap that caches the content backing the cursor

Public methods
open Unit

open MutableMap<String!, ContentValues!>!

open ContentValues!
getValues(rowName: String!)

Access the ContentValues for the row specified by rowName

open Unit

Requeries the cursor and reads the contents into the cache

open Unit
setKeepUpdated(keepUpdated: Boolean)

Change whether or not the ContentQueryMap will register with the cursor's ContentProvider for change notifications.

Protected methods
open Unit

Inherited functions

Public constructors

ContentQueryMap

Added in API level 1
ContentQueryMap(
    cursor: Cursor!,
    columnNameOfKey: String!,
    keepUpdated: Boolean,
    handlerForUpdateNotifications: Handler!)

Creates a ContentQueryMap that caches the content backing the cursor

Parameters
cursor Cursor!: the cursor whose contents should be cached
columnNameOfKey String!: the column that is to be used as the key of the values map
keepUpdated Boolean: true if the cursor's ContentProvider should be monitored for changes and the map updated when changes do occur
handlerForUpdateNotifications Handler!: the Handler that should be used to receive notifications of changes (if requested). Normally you pass null here, but if you know that the thread that is creating this isn't a thread that can receive messages then you can create your own handler and use that here.

Public methods

close

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

getRows

Added in API level 1
open fun getRows(): MutableMap<String!, ContentValues!>!

getValues

Added in API level 1
open fun getValues(rowName: String!): ContentValues!

Access the ContentValues for the row specified by rowName

Parameters
rowName String!: which row to read
Return
ContentValues! the ContentValues for the row, or null if the row wasn't present in the cursor

requery

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

Requeries the cursor and reads the contents into the cache

setKeepUpdated

Added in API level 1
open fun setKeepUpdated(keepUpdated: Boolean): Unit

Change whether or not the ContentQueryMap will register with the cursor's ContentProvider for change notifications. If you use a ContentQueryMap in an activity you should call this with false in onPause(), which means you need to call it with true in onResume() if want it to be kept updated.

Parameters
keepUpdated Boolean: if true the ContentQueryMap should be registered with the cursor's ContentProvider, false otherwise

Protected methods

finalize

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