English | Site Directory

Android - An Open Handset Alliance Project

android.content
public class

android.content.ContentQueryMap

java.lang.Object
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 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, String columnNameOfKey, boolean keepUpdated, Handler handlerForUpdateNotifications)
Creates a ContentQueryMap that caches the contents of the cursor.

Public Methods

        void  close()
        Map  getRows()
        ContentValues  getValues(String rowName)
Access the ContentValues for the row specified by rowName
        void  requery()
Requeries the cursor and reads the contents into mValues
Methods inherited from class java.util.Observable
Methods inherited from class java.lang.Object

Details

Public Constructors

public ContentQueryMap(Cursor cursor, String columnNameOfKey, boolean keepUpdated, Handler handlerForUpdateNotifications)

Creates a ContentQueryMap that caches the contents of the cursor.

Parameters

cursor the cursor whose contents should be cached
columnNameOfKey the column that is to be used as the key of the values map
keepUpdated true if the cursor should be monitored for changes and the map updated when changes do occur
handlerForUpdateNotifications 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

public void close()

public Map getRows()

public ContentValues getValues(String rowName)

Access the ContentValues for the row specified by rowName

Parameters

rowName which row to read

Returns

  • the ContentValues for the row, or null if the row wasn't present in the cursor

public void requery()

Requeries the cursor and reads the contents into mValues
Build m5-rc15g - 14 May 2008 12:50