public class SortCursor extends AbstractCursor
AbstractCursor.SelfContentObserver
mClosed, mContentResolver, mCurrentRowID, mPos, mRowIdColumnIndex, mUpdatedRows
FIELD_TYPE_BLOB, FIELD_TYPE_FLOAT, FIELD_TYPE_INTEGER, FIELD_TYPE_NULL, FIELD_TYPE_STRING
Constructor and Description |
---|
SortCursor(Cursor[] cursors,
String sortcolumn) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes the Cursor, releasing all of its resources and making it completely invalid.
|
void |
deactivate()
Deactivates the Cursor, making all calls on it fail until
Cursor.requery() is called. |
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.
|
int |
getType(int column)
Returns data type of the given column's value.
|
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 |
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 |
unregisterDataSetObserver(DataSetObserver observer)
Unregister an observer that has previously been registered with this
cursor via
Cursor.registerContentObserver(android.database.ContentObserver) . |
checkPosition, copyStringToBuffer, fillWindow, finalize, getColumnCount, getColumnIndex, getColumnIndexOrThrow, getColumnName, getExtras, getNotificationUri, getPosition, getUpdatedField, getWantsAllOnMoveCalls, getWindow, isAfterLast, isBeforeFirst, isClosed, isFieldUpdated, isFirst, isLast, move, moveToFirst, moveToLast, moveToNext, moveToPosition, moveToPrevious, onChange, onDeactivateOrClose, registerContentObserver, respond, setExtras, setNotificationUri, setNotificationUri, unregisterContentObserver
public int getCount()
Cursor
getCount
in interface Cursor
getCount
in class AbstractCursor
public boolean onMove(int oldPosition, int newPosition)
AbstractCursor
onMove
in interface CrossProcessCursor
onMove
in class AbstractCursor
oldPosition
- the position that we're moving fromnewPosition
- the position that we're moving topublic String getString(int column)
Cursor
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.
getString
in interface Cursor
getString
in class AbstractCursor
column
- the zero-based index of the target column.public short getShort(int column)
Cursor
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.
getShort
in interface Cursor
getShort
in class AbstractCursor
column
- the zero-based index of the target column.public int getInt(int column)
Cursor
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.
getInt
in interface Cursor
getInt
in class AbstractCursor
column
- the zero-based index of the target column.public long getLong(int column)
Cursor
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.
getLong
in interface Cursor
getLong
in class AbstractCursor
column
- the zero-based index of the target column.public float getFloat(int column)
Cursor
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.
getFloat
in interface Cursor
getFloat
in class AbstractCursor
column
- the zero-based index of the target column.public double getDouble(int column)
Cursor
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.
getDouble
in interface Cursor
getDouble
in class AbstractCursor
column
- the zero-based index of the target column.public int getType(int column)
Cursor
Cursor.getInt(int)
, Cursor.getFloat(int)
etc.
Returned column types are
getType
in interface Cursor
getType
in class AbstractCursor
column
- the zero-based index of the target column.public boolean isNull(int column)
Cursor
true
if the value in the indicated column is null.isNull
in interface Cursor
isNull
in class AbstractCursor
column
- the zero-based index of the target column.public byte[] getBlob(int column)
Cursor
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.
getBlob
in interface Cursor
getBlob
in class AbstractCursor
column
- the zero-based index of the target column.public String[] getColumnNames()
Cursor
getColumnNames
in interface Cursor
getColumnNames
in class AbstractCursor
public void deactivate()
Cursor
Cursor.requery()
is called.
Inactive Cursors use fewer resources than active Cursors.
Calling Cursor.requery()
will make the cursor active again.deactivate
in interface Cursor
deactivate
in class AbstractCursor
public void close()
Cursor
Cursor.deactivate()
a call to Cursor.requery()
will not make the Cursor valid
again.close
in interface Cursor
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractCursor
public void registerDataSetObserver(DataSetObserver observer)
Cursor
Cursor.requery()
, Cursor.deactivate()
, or Cursor.close()
.registerDataSetObserver
in interface Cursor
registerDataSetObserver
in class AbstractCursor
observer
- the object that gets notified when the cursors data set changes.Cursor.unregisterDataSetObserver(DataSetObserver)
public void unregisterDataSetObserver(DataSetObserver observer)
Cursor
Cursor.registerContentObserver(android.database.ContentObserver)
.unregisterDataSetObserver
in interface Cursor
unregisterDataSetObserver
in class AbstractCursor
observer
- the object to unregister.Cursor.registerDataSetObserver(DataSetObserver)
public boolean requery()
Cursor
Cursor.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.requery
in interface Cursor
requery
in class AbstractCursor