Challenge: Efficient RecyclerView Reloading

Right now, when the user returns to the list screen after editing a single crime, CrimeListFragment redraws all of the visible crimes in the recycler view. The is wildly inefficient, because at most one Crime will have changed.

Update CrimeListFragment’s RecyclerView implementation to redraw only the row associated with the changed crime. To do this, update CrimeAdapter to extend from androidx.recyclerview.widget.ListAdapter<Crime, CrimeHolder> instead of RecyclerView.Adapter<CrimeHolder>.

ListAdapter is a RecyclerView.Adapter that figures out the difference between the current data set backing the recycler view and a new data set you apply to back the recycler view. The comparison happens ...

Get Android Programming: The Big Nerd Ranch Guide, 4th Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.