android mergecursor 排序,MergeCursor

Class Overview

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.

Summary

[Expand]

Inherited Constants

1feb1fe825b495b2e5041e0b1ec8781c.pngFrom interface

android.database.Cursor

int

Value returned by

int

Value returned by

int

Value returned by

int

Value returned by

int

Value returned by

[Expand]

Inherited Fields

1feb1fe825b495b2e5041e0b1ec8781c.pngFrom class

android.database.AbstractCursor

protected

boolean

protected

Long

This field was deprecated

in API level 16.

This field should not be used.

protected

int

protected

int

This field was deprecated

in API level 16.

This field should not be used.

This field was deprecated

in API level 11.

This is never updated by this class and should not be used

Public Constructors

Public Methods

void

Closes the Cursor, releasing all of its resources and making it completely invalid.

void

Deactivates the Cursor, making all calls on it fail until

byte[]

Returns the value of the requested column as a byte array.

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

Returns the numbers of rows in the cursor.

double

Returns the value of the requested column as a double.

float

Returns the value of the requested column as a float.

int

Returns the value of the requested column as an int.

long

Returns the value of the requested column as a long.

short

Returns the value of the requested column as a short.

Returns the value of the requested column as a String.

int

Returns data type of the given column's value.

boolean

Returns true if the value in the indicated column is null.

boolean

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

Register an observer that is called when changes happen to the content backing this cursor.

void

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

boolean

Performs the query that created the cursor again, refreshing its

contents.

void

Unregister an observer that has previously been registered with this

cursor via

void

Unregister an observer that has previously been registered with this

cursor via

[Expand]

Inherited Methods

1feb1fe825b495b2e5041e0b1ec8781c.png

From class

android.database.AbstractCursor

void

This function throws CursorIndexOutOfBoundsException if

the cursor position is out of bounds.

void

Closes the Cursor, releasing all of its resources and making it completely invalid.

void

Retrieves the requested column text and stores it in the buffer provided.

void

Deactivates the Cursor, making all calls on it fail until

void

Copies cursor data into the window.

void

Invoked when the garbage collector has detected that this instance is no longer reachable.

byte[]

Returns the value of the requested column as a byte array.

int

Return total number of columns

int

Returns the zero-based index for the given column name, or -1 if the column doesn't exist.

int

Returns the zero-based index for the given column name, or throws

Returns the column name at the given zero-based column index.

abstract

String[]

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.

abstract

int

Returns the numbers of rows in the cursor.

abstract

double

Returns the value of the requested column as a double.

Returns a bundle of extra values.

abstract

float

Returns the value of the requested column as a float.

abstract

int

Returns the value of the requested column as an int.

abstract

long

Returns the value of the requested column as a long.

final

int

Returns the current position of the cursor in the row set.

abstract

short

Returns the value of the requested column as a short.

abstract

String

Returns the value of the requested column as a String.

int

Returns data type of the given column's value.

This method was deprecated

in API level 11.

Always returns null since Cursors do not support updating rows

boolean

onMove() will only be called across processes if this method returns true.

If the cursor is backed by a

final

boolean

Returns whether the cursor is pointing to the position after the last

row.

final

boolean

Returns whether the cursor is pointing to the position before the first

row.

boolean

return true if the cursor is closed

boolean

This method was deprecated

in API level 11.

Always returns false since Cursors do not support updating rows

final

boolean

Returns whether the cursor is pointing to the first row.

final

boolean

Returns whether the cursor is pointing to the last row.

abstract

boolean

Returns true if the value in the indicated column is null.

final

boolean

Move the cursor by a relative amount, forward or backward, from the

current position.

final

boolean

Move the cursor to the first row.

final

boolean

Move the cursor to the last row.

final

boolean

Move the cursor to the next row.

final

boolean

Move the cursor to an absolute position.

final

boolean

Move the cursor to the previous row.

void

Subclasses must call this method when they finish committing updates to notify all

observers.

boolean

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

Register an observer that is called when changes happen to the content backing this cursor.

void

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

boolean

Performs the query that created the cursor again, refreshing its

contents.

This is an out-of-band way for the the user of a cursor to communicate with the cursor.

void

Specifies a content URI to watch for changes.

void

Unregister an observer that has previously been registered with this

cursor via

void

Unregister an observer that has previously been registered with this

cursor via

1feb1fe825b495b2e5041e0b1ec8781c.png

From class

java.lang.Object

Creates and returns a copy of this Object.

boolean

Compares this instance with the specified object and indicates if they

are equal.

void

Invoked when the garbage collector has detected that this instance is no longer reachable.

final

Class>

Returns the unique instance of

int

Returns an integer hash code for this object.

final

void

Causes a thread which is waiting on this object's monitor (by means of

calling one of the wait() methods) to be woken up.

final

void

Causes all threads which are waiting on this object's monitor (by means

of calling one of the wait() methods) to be woken up.

Returns a string containing a concise, human-readable description of this

object.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

final

void

Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the

specified timeout expires.

1feb1fe825b495b2e5041e0b1ec8781c.png

From interface

android.database.CrossProcessCursor

abstract

void

Copies cursor data into the window.

Returns a pre-filled window that contains the data within this cursor.

abstract

boolean

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.

1feb1fe825b495b2e5041e0b1ec8781c.png

From interface

android.database.Cursor

abstract

void

Closes the Cursor, releasing all of its resources and making it completely invalid.

abstract

void

Retrieves the requested column text and stores it in the buffer provided.

abstract

void

This method was deprecated

in API level 16.

Since

abstract

byte[]

Returns the value of the requested column as a byte array.

abstract

int

Return total number of columns

abstract

int

Returns the zero-based index for the given column name, or -1 if the column doesn't exist.

abstract

int

Returns the zero-based index for the given column name, or throws

abstract

String

Returns the column name at the given zero-based column index.

abstract

String[]

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.

abstract

int

Returns the numbers of rows in the cursor.

abstract

double

Returns the value of the requested column as a double.

abstract

Bundle

Returns a bundle of extra values.

abstract

float

Returns the value of the requested column as a float.

abstract

int

Returns the value of the requested column as an int.

abstract

long

Returns the value of the requested column as a long.

abstract

int

Returns the current position of the cursor in the row set.

abstract

short

Returns the value of the requested column as a short.

abstract

String

Returns the value of the requested column as a String.

abstract

int

Returns data type of the given column's value.

abstract

boolean

onMove() will only be called across processes if this method returns true.

abstract

boolean

Returns whether the cursor is pointing to the position after the last

row.

abstract

boolean

Returns whether the cursor is pointing to the position before the first

row.

abstract

boolean

return true if the cursor is closed

abstract

boolean

Returns whether the cursor is pointing to the first row.

abstract

boolean

Returns whether the cursor is pointing to the last row.

abstract

boolean

Returns true if the value in the indicated column is null.

abstract

boolean

Move the cursor by a relative amount, forward or backward, from the

current position.

abstract

boolean

Move the cursor to the first row.

abstract

boolean

Move the cursor to the last row.

abstract

boolean

Move the cursor to the next row.

abstract

boolean

Move the cursor to an absolute position.

abstract

boolean

Move the cursor to the previous row.

abstract

void

Register an observer that is called when changes happen to the content backing this cursor.

abstract

void

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

abstract

boolean

This method was deprecated

in API level 11.

Don't use this. Just request a new cursor, so you can do this

asynchronously and update your list view once the new cursor comes back.

abstract

Bundle

This is an out-of-band way for the the user of a cursor to communicate with the cursor.

abstract

void

Register to watch a content URI for changes.

abstract

void

Unregister an observer that has previously been registered with this

cursor via

abstract

void

Unregister an observer that has previously been registered with this

cursor via

1feb1fe825b495b2e5041e0b1ec8781c.png

From interface

java.io.Closeable

abstract

void

Closes the object and release any system resources it holds.

Public Constructors

public

MergeCursor

(Cursor[] cursors)

Public Methods

public

void

close

()

Closes the Cursor, releasing all of its resources and making it completely invalid.

Unlike

public

void

deactivate

()

Deactivates the Cursor, making all calls on it fail until

public

byte[]

getBlob

(int column)

Returns the value of the requested column as a byte array.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a byte array.

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.

Returns

the names of the columns returned in this query.

public

int

getCount

()

Returns the numbers of rows in the cursor.

Returns

the number of rows in the cursor.

public

double

getDouble

(int column)

Returns the value of the requested column as a double.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a double.

public

float

getFloat

(int column)

Returns the value of the requested column as a float.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a float.

public

int

getInt

(int column)

Returns the value of the requested column as an int.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as an int.

public

long

getLong

(int column)

Returns the value of the requested column as a long.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a long.

public

short

getShort

(int column)

Returns the value of the requested column as a short.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a short.

public

String

getString

(int column)

Returns the value of the requested column as a String.

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.

Parameters

columnthe zero-based index of the target column.

Returns

the value of that column as a String.

public

int

getType

(int column)

Returns data type of the given column's value.

The preferred type of the column is returned but the data may be converted to other types

as documented in the get-type methods such as

Returned column types are

Parameters

columnthe zero-based index of the target column.

Returns

column value type

public

boolean

isNull

(int column)

Returns true if the value in the indicated column is null.

Parameters

columnthe zero-based index of the target column.

Returns

whether the column value is null.

public

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. If it returns false the move function will also do so and the

cursor will scroll to the beforeFirst position.

Parameters

oldPositionthe position that we're moving from

newPositionthe position that we're moving to

Returns

true if the move is successful, false otherwise

public

void

registerContentObserver

Register an observer that is called when changes happen to the content backing this cursor.

Typically the data set won't change until

Parameters

observerthe object that gets notified when the content backing the cursor changes.

public

void

registerDataSetObserver

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

Parameters

observerthe object that gets notified when the cursors data set changes.

public

boolean

requery

()

Performs the query that created the cursor again, refreshing its

contents. This may be done at any time, including after a call to

Returns

true if the requery succeeded, false if not, in which case the

cursor becomes invalid.

public

void

unregisterContentObserver

Unregister an observer that has previously been registered with this

cursor via

Parameters

observerthe object to unregister.

public

void

unregisterDataSetObserver

Unregister an observer that has previously been registered with this

cursor via

Parameters

observerthe object to unregister.

Except as noted, this content is licensed under Apache 2.0.

For details and restrictions, see the Content License.

Android 4.2 r1 —

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值