In this Android developer document https://developer.android.com/guide/topics/ui/layout/recyclerview#java , the annotation of the method onBindViewHolder(MyViewHolder holder, int position) in the MyAdapter class reads:
// Replace the contents of a view (invoked by the layout manager)
My question is: which line(s) of code in the lay out manager invoke (call) this method?
During layout phase
onLayoutChildren (RecyclerView.Recycler recycler, RecyclerView.State state) is called.
Recycler is used to call
getViewForPosition (int position) which internally manages cached view pool and triggers adapters
onCreateViewHolder (if there’s no view to reuse) and
onBindViewHolder to return
View that’s ready to be added to view hierarchy.