How to use AsyncListUtil

A tutorial for the Support Library’s AsyncListUtil, and how to correctly back your RecyclerView with data from a SQLite database.

Photo by Ahsan Avi on Unsplash
A slide from my talk. I still agree with this in principle, but as it turns out: for RecyclerView adapters it’s just plain wrong.

RecyclerView Architecture

RecyclerView + AsyncListUtil Architecture

Hmm…

Implementing AsyncListUtil

Not bad.

The Data

The ItemSource

The Callbacks

The OnScrollListener: make AsyncListUtil aware of viewport changes

The ViewHolder

The Adapter

The Activity: Putting it all together

In Conclusion

Software Engineer at Google. You can find my stuff on GitHub at https://github.com/jasonwyatt