Build 1.0_r1(from source)

android.provider
Class Gmail.MailCursor

java.lang.Object
  extended by android.database.ContentObserver
      extended by android.provider.Gmail.MailCursor
Direct Known Subclasses:
Gmail.ConversationCursor, Gmail.LabelCursor, Gmail.MessageCursor
Enclosing class:
Gmail

public static class Gmail.MailCursor
extends ContentObserver

This is a cursor that only defines methods to move throught the results and register to hear about changes. All access to the data is left to subinterfaces.


Field Summary
protected  String mAccount
           
protected  Cursor mCursor
           
 
Constructor Summary
protected Gmail.MailCursor(String account, Cursor cursor)
          Constructs the MailCursor given a regular cursor, registering as a change observer of the cursor.
 
Method Summary
protected  void checkCursor()
           
protected  void checkThread()
           
 int count()
          Returns the numbers of rows in the cursor.
 boolean deliverSelfNotifications()
          Returns true if this observer is interested in notifications for changes made through the cursor the observer is registered with.
 String getAccount()
          Gets the account associated with this cursor.
 Cursor getCursor()
           
protected  String getStringInColumn(int columnIndex)
          Returns the string value of the column, or "" if the value is null.
protected  ContentValues getUpdateValues()
          Lazily constructs a map of update values to apply to the database if requested.
 boolean moveTo(int position)
          Move the cursor to an absolute position.
 boolean next()
          Move the cursor to the next row.
 void onChange(boolean selfChange)
          This method is called when a change occurs to the cursor that is being observed.
protected  void onCursorPositionChanged()
          Called whenever mCursor is changed to point to a different row.
 int position()
           
 void registerContentObserver(ContentObserver observer)
           
 void registerDataSetObserver(DataSetObserver observer)
           
 void registerObserver(Gmail.MailCursorObserver observer)
          Register an observer to hear about changes to the cursor.
 void release()
          Release all resources and locks associated with the cursor.
 void unregisterContentObserver(ContentObserver observer)
           
 void unregisterDataSetObserver(DataSetObserver observer)
           
 void unregisterObserver(Gmail.MailCursorObserver observer)
          Unregister an observer.
 
Methods inherited from class android.database.ContentObserver
dispatchChange, getContentObserver, releaseContentObserver
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

mCursor

protected Cursor mCursor

mAccount

protected String mAccount
Constructor Detail

Gmail.MailCursor

protected Gmail.MailCursor(String account,
                           Cursor cursor)
Constructs the MailCursor given a regular cursor, registering as a change observer of the cursor.

Parameters:
account - the account the cursor is associated with
cursor - the underlying cursor
Method Detail

getCursor

public Cursor getCursor()

getAccount

public String getAccount()
Gets the account associated with this cursor.

Returns:
the account.

checkThread

protected void checkThread()

getUpdateValues

protected ContentValues getUpdateValues()
Lazily constructs a map of update values to apply to the database if requested. This map is cleared out when we move to a different item in the result set.

Returns:
a map of values to be applied by an update.

onCursorPositionChanged

protected void onCursorPositionChanged()
Called whenever mCursor is changed to point to a different row. Subclasses should override this if they need to clear out state when this happens. Subclasses must call the inherited version if they override this.


count

public final int count()
Returns the numbers of rows in the cursor.

Returns:
the number of rows in the cursor.

position

public final int position()
Returns:
the current position of this cursor, or -1 if this cursor has not been initialized.

moveTo

public final boolean moveTo(int position)
Move the cursor to an absolute position. The valid range of vaues is -1 <= position <= count.

This method will return true if the request destination was reachable, otherwise it returns false.

Parameters:
position - the zero-based position to move to.
Returns:
whether the requested move fully succeeded.

next

public final boolean next()
Move the cursor to the next row.

This method will return false if the cursor is already past the last entry in the result set.

Returns:
whether the move succeeded.

release

public final void release()
Release all resources and locks associated with the cursor. The cursor will not be valid after this function is called.


registerContentObserver

public final void registerContentObserver(ContentObserver observer)

unregisterContentObserver

public final void unregisterContentObserver(ContentObserver observer)

registerDataSetObserver

public final void registerDataSetObserver(DataSetObserver observer)

unregisterDataSetObserver

public final void unregisterDataSetObserver(DataSetObserver observer)

registerObserver

public final void registerObserver(Gmail.MailCursorObserver observer)
Register an observer to hear about changes to the cursor.

Parameters:
observer - the observer to register

unregisterObserver

public final void unregisterObserver(Gmail.MailCursorObserver observer)
Unregister an observer.

Parameters:
observer - the observer to unregister

deliverSelfNotifications

public final boolean deliverSelfNotifications()
Description copied from class: ContentObserver
Returns true if this observer is interested in notifications for changes made through the cursor the observer is registered with.

Overrides:
deliverSelfNotifications in class ContentObserver

onChange

public void onChange(boolean selfChange)
Description copied from class: ContentObserver
This method is called when a change occurs to the cursor that is being observed.

Overrides:
onChange in class ContentObserver
Parameters:
selfChange - true if the update was caused by a call to commit on the cursor that is being observed.

checkCursor

protected void checkCursor()

getStringInColumn

protected String getStringInColumn(int columnIndex)
Returns the string value of the column, or "" if the value is null.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature