Adam Hurwitz
1 min readJul 12, 2020

--

An important note on threading for PagedLists with Room above is that threading is handled on the background thread by the PagedList with the toLiveData extension function.

If you use LivePagedListBuilder to get a LiveData<PagedList>, it will initialize PagedLists on a background thread for you.

This might not be obvious to some reading through the developer guide, but is nicely outlined in the PagedList doc link above. I think this would be useful to include in the main Room developer docs to avoid confusion and potentially unnecessarily launching a Room query for a PagedList in a Dispatchers.IO thread with a coroutine.

--

--

Adam Hurwitz

An account about nothing | Researcher and product consultant