You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
whose analogy is to replace a person in a moving vehicle in Disneyland attractions.
position should NOT be used in a click listener because position is only the snapshot of a position when binding occurs. Use getBindingAdapterPosition() instead.
It is recommended to call ViewDataBinding.executePendingBindings() at the end of onBindViewHolder() if data binding is used. Otherwise the size of the ViewHolder may not be correctly measured before it is rendered, so re-rendering will occur.
notifyDataSetChanged() should be called after ListAdapter.submitList(...) or UI does not change.
getItemId(position: Int) returns the ID of an item at a given position.
This method is available only if RecyclerView.Adapter.hasStableIds() is true.
setHasStableIds(hasStableIds: Boolean) takes true when each item has an ID.
RecyclerView.ViewHolder
is created by RecyclerView.Adapter.onCreateViewHolder(...) only as many as necessary for screen.
contains an item by RecyclerView.Adapter.onBindViewHolder(...).
As you scroll, a ViewHolder that goes off screen will be moved to the opposite end of the screen to display a new item.
getBindingAdapterPosition()
returns an adapter position.
returns RecyclerView.NO_POSITION between notifyDataSetChanged() and the new frame has not been rendered. FYI, frames are rendered every 16 milliseconds.
getItemId() returns the ID of an item bound to the ViewHolder.
getAbsoluteAdapterPosition() returns a MergeAdapter position.
getLayoutPosition() returns a layout position.
How to save and store RecyclerView's state during a configuration change or a system-initiated process death