Adapter
abstract class Adapter<VH : RecyclerView.ViewHolder!>
kotlin.Any | |
↳ | androidx.recyclerview.widget.RecyclerView.Adapter |
Base class for an Adapter
Adapters provide a binding from an app-specific data set to views that are displayed within a RecyclerView
.
Summary
Nested classes | |
---|---|
Defines how this Adapter wants to restore its state after a view reconstruction (e.g. configuration change). |
Public constructors | |
---|---|
<init>() Base class for an Adapter |
Public methods | |
---|---|
Unit |
bindViewHolder(@NonNull holder: VH, position: Int) This method internally calls |
VH |
createViewHolder(@NonNull parent: ViewGroup, viewType: Int) This method calls |
open Int |
findRelativeAdapterPositionIn(@NonNull adapter: RecyclerView.Adapter<out RecyclerView.ViewHolder!>, @NonNull viewHolder: RecyclerView.ViewHolder, localPosition: Int) Returns the position of the given |
abstract Int |
Returns the total number of items in the data set held by the adapter. |
open Long |
Return the stable ID for the item at |
open Int |
getItemViewType(position: Int) Return the view type of the item at |
RecyclerView.Adapter.StateRestorationPolicy |
Returns when this Adapter wants to restore the state. |
Boolean |
Returns true if one or more observers are attached to this adapter. |
Boolean |
Returns true if this adapter publishes a unique |
Unit |
Notify any registered observers that the data set has changed. |
Unit |
notifyItemChanged(position: Int) Notify any registered observers that the item at |
Unit |
notifyItemChanged(position: Int, @Nullable payload: Any?) Notify any registered observers that the item at |
Unit |
notifyItemInserted(position: Int) Notify any registered observers that the item reflected at |
Unit |
notifyItemMoved(fromPosition: Int, toPosition: Int) Notify any registered observers that the item reflected at |