Added in API level 1

BaseAdapter


abstract class BaseAdapter : ListAdapter, SpinnerAdapter
kotlin.Any
   ↳ android.widget.BaseAdapter

Common base class of common implementation for an Adapter that can be used in both ListView (by implementing the specialized ListAdapter interface) and Spinner (by implementing the specialized SpinnerAdapter interface).

Summary

Public constructors

Public methods
open Boolean

open Array<CharSequence!>?

open View!
getDropDownView(position: Int, convertView: View!, parent: ViewGroup!)

open Int
getItemViewType(position: Int)

open Int

open Boolean

open Boolean

open Boolean
isEnabled(position: Int)

open Unit

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

open Unit

Notifies the attached observers that the underlying data is no longer valid or available.

open Unit

open Unit
setAutofillOptions(vararg options: CharSequence!)

Sets the value returned by getAutofillOptions()

open Unit

Public constructors

BaseAdapter

BaseAdapter()

Public methods

areAllItemsEnabled

Added in API level 1
open fun areAllItemsEnabled(): Boolean
Return
Boolean True if all items are enabled, false otherwise.

getAutofillOptions

Added in API level 26
open fun getAutofillOptions(): Array<CharSequence!>?
Return
Array<CharSequence!>? null by default, unless implementations override it.

getDropDownView

Added in API level 1
open fun getDropDownView(
    position: Int,
    convertView: View!,
    parent: ViewGroup!
): View!
Parameters
position Int: index of the item whose view we want.
convertView View!: the old view to reuse, if possible. Note: You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view.
parent ViewGroup!: the parent that this view will eventually be attached to
Return
View! a android.view.View corresponding to the data at the specified position.

getItemViewType

Added in API level 1
open fun getItemViewType(position: Int): Int
Parameters
position Int: The position of the item within the adapter's data set whose view type we want.
Return
Int An integer representing the type of View. Two views should share the same type if one can be converted to the other in getView. Note: Integers must be in the range 0 to getViewTypeCount - 1. IGNORE_ITEM_VIEW_TYPE can also be returned.

getViewTypeCount

Added in API level 1
open fun getViewTypeCount(): Int
Return
Int The number of types of Views that will be created by this adapter

hasStableIds

Added in API level 1
open fun hasStableIds(): Boolean
Return
Boolean True if the same id always refers to the same object.

isEmpty

Added in API level 1
open fun isEmpty(): Boolean
Return
Boolean true if this adapter doesn't contain any data. This is used to determine whether the empty view should be displayed. A typical implementation will return getCount() == 0 but since getCount() includes the headers and footers, specialized adapters might want a different behavior.

isEnabled

Added in API level 1
open fun isEnabled(position: Int): Boolean
Parameters
position Int: Index of the item
Return
Boolean True if the item is not a separator

notifyDataSetChanged

Added in API level 1
open fun notifyDataSetChanged(): Unit

Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

notifyDataSetInvalidated

Added in API level 1
open fun notifyDataSetInvalidated(): Unit

Notifies the attached observers that the underlying data is no longer valid or available. Once invoked this adapter is no longer valid and should not report further data set changes.

registerDataSetObserver

Added in API level 1
open fun registerDataSetObserver(observer: DataSetObserver!): Unit
Parameters
observer DataSetObserver!: the object that gets notified when the data set changes.

setAutofillOptions

Added in API level 27
open fun setAutofillOptions(vararg options: CharSequence!): Unit

Sets the value returned by getAutofillOptions()

Parameters
options CharSequence!: This value may be null.

unregisterDataSetObserver

Added in API level 1
open fun unregisterDataSetObserver(observer: DataSetObserver!): Unit
Parameters
observer DataSetObserver!: the object to unregister.