May 2022
Intermediate to advanced
688 pages
20h 12m
English
Figure 10.6 is somewhat simplified. RecyclerView does not create ViewHolders itself. Instead, it asks an adapter. An adapter is a controller object that sits between the RecyclerView and the data set that the RecyclerView should display.
The adapter is responsible for:
creating the necessary ViewHolders when asked
binding data to ViewHolders from the model layer when asked
The recycler view is responsible for:
asking the adapter to create a new ViewHolder
asking the adapter to bind a ViewHolder to the item from the backing data at a given position
Time to create your adapter. Add a new class named CrimeListAdapter in CrimeListAdapter.kt. Add a primary constructor ...
Read now
Unlock full access