CursorAdapter
abstract class CursorAdapter : BaseAdapter, Filterable, CursorFilterClient
kotlin.Any | ||
↳ | android.widget.BaseAdapter | |
↳ | androidx.cursoradapter.widget.CursorAdapter |
Static library support version of the framework's android.widget.CursorAdapter
. Used to write apps that run on platforms prior to Android 3.0. When running on Android 3.0 or above, this implementation is still used; it does not try to switch to the framework's implementation. See the framework SDK documentation for a class overview.
Summary
Constants | |
---|---|
static Int |
If set the adapter will call requery() on the cursor whenever a content change notification is delivered. |
static Int |
If set the adapter will register a content observer on the cursor and will call |
Public constructors | |
---|---|
Constructor that always enables auto-requery. |
|
Constructor that allows control over auto-requery. |
|
Recommended constructor. |
Public methods | |
---|---|
abstract Unit |
Bind an existing view to the data pointed to by cursor |
open Unit |
changeCursor(cursor: Cursor!) Change the underlying cursor to a new cursor. |
open CharSequence! |
convertToString(cursor: Cursor!) Converts the cursor into a CharSequence. |
open Int |
getCount() |
open Cursor! |
Returns the cursor. |
open View! |
getDropDownView(position: Int, convertView: View!, parent: ViewGroup!) |
open Filter! | |
open FilterQueryProvider! |
Returns the query filter provider used for filtering. |
open Any! | |
open Long | |
open View! | |
open Boolean | |
open View! |
newDropDownView(context: Context!, cursor: Cursor!, parent: ViewGroup!) Makes a new drop down view to hold the data pointed to by cursor. |
abstract View! |
Makes a new view to hold the data pointed to by cursor. |
open Cursor! |
runQueryOnBackgroundThread(constraint: CharSequence!) Runs a query with the specified constraint. |
open Unit |
setFilterQueryProvider(filterQueryProvider: FilterQueryProvider!) Sets the query filter provider used to filter the current Cursor. |
open Cursor! |
swapCursor(newCursor: Cursor!) Swap in a new Cursor, returning the old Cursor. |
Protected methods | |
---|---|
open Unit | |
open Unit |
Called when the |
Constants
FLAG_AUTO_REQUERY
static valFLAG_AUTO_REQUERY: Int
Deprecated: This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use android.app.LoaderManager
with a android.content.CursorLoader
.
If set the adapter will call requery() on the cursor whenever a content change notification is delivered. Implies FLAG_REGISTER_CONTENT_OBSERVER
.
Value: 0x01
FLAG_REGISTER_CONTENT_OBSERVER
static val FLAG_REGISTER_CONTENT_OBSERVER: Int
If set the adapter will register a content observer on the cursor and will call onContentChanged()
when a notification comes in. Be careful when using this flag: you will need to unset the current Cursor from the adapter to avoid leaks due to its registered observers. This flag is not needed when using a CursorAdapter with a android.content.CursorLoader
.
Value: 0x02
Public constructors
<init>
CursorAdapter(
context: Context!,
c: Cursor!)
Deprecated: This option is discouraged, as it results in Cursor queries being performed on the application's UI thread and thus can cause poor responsiveness or even Application Not Responding errors. As an alternative, use android.app.LoaderManager
with a android.content.CursorLoader
.
Constructor that always enables auto-requery.
Parameters | |
---|---|
c |
Cursor!: The cursor from which to get the data. |
context |
Context!: The context |
<init>
CursorAdapter(
context: Context!,
c: Cursor!,
autoRequery: Boolean)
Constructor that allows control over auto-requery. It is recommended you not use this, but instead CursorAdapter(Context, Cursor, int)
. When using this constructor, FLAG_REGISTER_CONTENT_OBSERVER
will always be set.
Parameters | |
---|---|
c |
Cursor!: The cursor from which to get the data. |
context |
Context!: The context |
autoRequery |
Boolean: If true the adapter will call requery() on the cursor whenever it changes so the most recent data is always displayed. Using true here is discouraged. |
<init>
CursorAdapter(
context: Context!,
c: Cursor!,
flags: Int)
Recommended constructor.
Parameters | |
---|---|
c |
Cursor!: The cursor from which to get the data. |
context |
Context!: The context |
flags |
Int: Flags used to determine the behavior of the adapter; may be any combination of FLAG_AUTO_REQUERY and FLAG_REGISTER_CONTENT_OBSERVER . |
Public methods
bindView
abstract fun bindView(
view: View!,
context: Context!,
cursor: Cursor!
): Unit
Bind an existing view to the data pointed to by cursor
Parameters | |
---|---|
view |
View!: Existing view, returned earlier by newView |
context |
Context!: Interface to application's global information |
cursor |
Cursor!: The cursor from which to get the data. The cursor is already moved to the correct position. |