Build 1.0_r1(from source)

android.database
Class MergeCursor

java.lang.Object
  extended by android.database.AbstractCursor
      extended by android.database.MergeCursor
All Implemented Interfaces:
CrossProcessCursor, Cursor

public class MergeCursor
extends AbstractCursor

A convience 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.


Nested Class Summary
 
Nested classes/interfaces inherited from class android.database.AbstractCursor
AbstractCursor.SelfContentObserver
 
Field Summary
 
Fields inherited from class android.database.AbstractCursor
mClosed, mContentObservable, mContentResolver, mCurrentRowID, mDataSetObservable, mPos, mRowIdColumnIndex, mUpdatedRows
 
Constructor Summary
MergeCursor(Cursor[] cursors)
           
 
Method Summary
 void close()
          Closes the Cursor, releasing all of its resources and making it completely invalid.
 boolean commitUpdates()
          Deprecated.  
 void deactivate()
          Deactivates the Cursor, making all calls on it fail until Cursor.requery() is called.
 boolean deleteRow()
          Deprecated.  
 byte[] getBlob(int column)
          Returns the value of the requested column as a byte array.
 String[] getColumnNames()
          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.
 int getCount()
          Returns the numbers of rows in the cursor.
 double getDouble(int column)
          Returns the value of the requested column as a double.
 float getFloat(int column)
          Returns the value of the requested column as a float.
 int getInt(int column)
          Returns the value of the requested column as an int.
 long getLong(int column)
          Returns the value of the requested column as a long.
 short getShort(int column)
          Returns the value of the requested column as a short.
 String getString(int column)
          Returns the value of the requested column as a String.
 boolean isNull(int column)
          Returns true if the value in the indicated column is null.
 boolean onMove(int oldPosition, int newPosition)
          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.
 void registerContentObserver(ContentObserver observer)
          Register an observer that is called when changes happen to the content backing this cursor.
 void registerDataSetObserver(DataSetObserver observer)
          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 Cursor.requery(), Cursor.deactivate(), or Cursor.close().
 boolean requery()
          Performs the query that created the cursor again, refreshing its contents.
 void unregisterContentObserver(ContentObserver observer)
          Unregister an observer that has previously been registered with this cursor via Cursor.registerContentObserver(android.database.ContentObserver).
 void unregisterDataSetObserver(DataSetObserver observer)
          Unregister an observer that has previously been registered with this cursor via Cursor.registerContentObserver(android.database.ContentObserver).
 
Methods inherited from class android.database.AbstractCursor
abortUpdates, checkPosition, commitUpdates, copyStringToBuffer, deactivateInternal, fillWindow, finalize, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getExtras, getPosition, getUpdatedField, getWantsAllOnMoveCalls, getWindow, hasUpdates, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, respond, setNotificationUri, supportsUpdates, update, updateBlob, updateDouble, updateFloat, updateInt, updateLong, updateShort, updateString, updateToNull
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MergeCursor

public MergeCursor(Cursor[] cursors)
Method Detail

getCount

public int getCount()
Description copied from interface: Cursor
Returns the numbers of rows in the cursor.

Specified by:
getCount in interface Cursor
Specified by:
getCount in class AbstractCursor
Returns:
the number of rows in the cursor.

onMove

public boolean onMove(int oldPosition,
                      int newPosition)
Description copied from class: AbstractCursor
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.

Specified by:
onMove in interface CrossProcessCursor
Overrides:
onMove in class AbstractCursor
Parameters:
oldPosition - the position that we're moving from
newPosition - the position that we're moving to
Returns:
true if the move is successful, false otherwise

deleteRow

public boolean deleteRow()
Deprecated. 

Description copied from interface: Cursor
Removes the row at the current cursor position from the underlying data store. After this method returns the cursor will be pointing to the row after the row that is deleted. This has the side effect of decrementing the result of count() by one.

The query must have the row ID column in its selection, otherwise this call will fail.

Specified by:
deleteRow in interface Cursor
Overrides:
deleteRow in class AbstractCursor
Returns:
whether the record was successfully deleted.

commitUpdates

public boolean commitUpdates()
Deprecated. 

Description copied from interface: Cursor
Atomically commits all updates to the backing store. After completion, this method leaves the data in an inconsistent state and you should call Cursor.requery() before reading data from the cursor again.

Specified by:
commitUpdates in interface Cursor
Overrides:
commitUpdates in class AbstractCursor
Returns:
whether the operation succeeded.

getString

public String getString(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a String.

If the native content of that column is not text the result will be the result of passing the column value to String.valueOf(x).

Specified by:
getString in interface Cursor
Specified by:
getString in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a String.

getShort

public short getShort(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a short.

If the native content of that column is not numeric the result will be the result of passing the column value to Short.valueOf(x).

Specified by:
getShort in interface Cursor
Specified by:
getShort in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a short.

getInt

public int getInt(int column)
Description copied from interface: Cursor
Returns the value of the requested column as an int.

If the native content of that column is not numeric the result will be the result of passing the column value to Integer.valueOf(x).

Specified by:
getInt in interface Cursor
Specified by:
getInt in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as an int.

getLong

public long getLong(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a long.

If the native content of that column is not numeric the result will be the result of passing the column value to Long.valueOf(x).

Specified by:
getLong in interface Cursor
Specified by:
getLong in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a long.

getFloat

public float getFloat(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a float.

If the native content of that column is not numeric the result will be the result of passing the column value to Float.valueOf(x).

Specified by:
getFloat in interface Cursor
Specified by:
getFloat in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a float.

getDouble

public double getDouble(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a double.

If the native content of that column is not numeric the result will be the result of passing the column value to Double.valueOf(x).

Specified by:
getDouble in interface Cursor
Specified by:
getDouble in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a double.

isNull

public boolean isNull(int column)
Description copied from interface: Cursor
Returns true if the value in the indicated column is null.

Specified by:
isNull in interface Cursor
Specified by:
isNull in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
whether the column value is null.

getBlob

public byte[] getBlob(int column)
Description copied from interface: Cursor
Returns the value of the requested column as a byte array.

If the native content of that column is not blob exception may throw

Specified by:
getBlob in interface Cursor
Overrides:
getBlob in class AbstractCursor
Parameters:
column - the zero-based index of the target column.
Returns:
the value of that column as a byte array.

getColumnNames

public String[] getColumnNames()
Description copied from interface: Cursor
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.

Specified by:
getColumnNames in interface Cursor
Specified by:
getColumnNames in class AbstractCursor
Returns:
the names of the columns returned in this query.

deactivate

public void deactivate()
Description copied from interface: Cursor
Deactivates the Cursor, making all calls on it fail until Cursor.requery() is called. Inactive Cursors use fewer resources than active Cursors. Calling Cursor.requery() will make the cursor active again.

Specified by:
deactivate in interface Cursor
Overrides:
deactivate in class AbstractCursor

close

public void close()
Description copied from interface: Cursor
Closes the Cursor, releasing all of its resources and making it completely invalid. Unlike Cursor.deactivate() a call to Cursor.requery() will not make the Cursor valid again.

Specified by:
close in interface Cursor
Overrides:
close in class AbstractCursor

registerContentObserver

public void registerContentObserver(ContentObserver observer)
Description copied from interface: Cursor
Register an observer that is called when changes happen to the content backing this cursor. Typically the data set won't change until Cursor.requery() is called.

Specified by:
registerContentObserver in interface Cursor
Overrides:
registerContentObserver in class AbstractCursor
Parameters:
observer - the object that gets notified when the content backing the cursor changes.
See Also:
Cursor.unregisterContentObserver(ContentObserver)

unregisterContentObserver

public void unregisterContentObserver(ContentObserver observer)
Description copied from interface: Cursor
Unregister an observer that has previously been registered with this cursor via Cursor.registerContentObserver(android.database.ContentObserver).

Specified by:
unregisterContentObserver in interface Cursor
Overrides:
unregisterContentObserver in class AbstractCursor
Parameters:
observer - the object to unregister.
See Also:
Cursor.registerContentObserver(ContentObserver)

registerDataSetObserver

public void registerDataSetObserver(DataSetObserver observer)
Description copied from interface: Cursor
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 Cursor.requery(), Cursor.deactivate(), or Cursor.close().

Specified by:
registerDataSetObserver in interface Cursor
Overrides:
registerDataSetObserver in class AbstractCursor
Parameters:
observer - the object that gets notified when the cursors data set changes.
See Also:
Cursor.unregisterDataSetObserver(DataSetObserver)

unregisterDataSetObserver

public void unregisterDataSetObserver(DataSetObserver observer)
Description copied from interface: Cursor
Unregister an observer that has previously been registered with this cursor via Cursor.registerContentObserver(android.database.ContentObserver).

Specified by:
unregisterDataSetObserver in interface Cursor
Overrides:
unregisterDataSetObserver in class AbstractCursor
Parameters:
observer - the object to unregister.
See Also:
Cursor.registerDataSetObserver(DataSetObserver)

requery

public boolean requery()
Description copied from interface: Cursor
Performs the query that created the cursor again, refreshing its contents. This may be done at any time, including after a call to Cursor.deactivate().

Specified by:
requery in interface Cursor
Overrides:
requery in class AbstractCursor
Returns:
true if the requery succeeded, false if not, in which case the cursor becomes invalid.

Build 1.0_r1(from source)

Please submit a feedback, bug or feature