Paging library — Which configuration to use???

Nataraj KR
2 min readDec 2, 2019

--

Photo by Caspar Camille Rubin on Unsplash

This article assumes that the reader is familiar with the paging library implementation.

Paging library in android has eased the life of developers, especially dealing with large lists of data loading lazily. Nevertheless, it can be used in various configurations:

  1. Database with Network
  2. Only Database
  3. only Network

Most of the developers recommend using paging with database-network configuration so that there is a single source of truth. But there is much more than that to use database-network configuration.

Say that if you are changing the data on the go according to the user interactions. A paged list does not allow you to edit the individual item in the list. So it is not possible for you without a workaround to call the adapter’s notifyItem…methods to make your recycler view reflect the data changes.

But with database-network configuration, one can always listen to changes in the database with the help of room and other architecture components. By changing the data in the database with respect to user interactions recycler view gets updated seamlessly.

If your list has no change of data based on user interactions it is not necessary to use database-network configuration in particular.

.

.

.

Thank you for reading this article.

--

--

No responses yet