1

Right now I'm working on an Android project which contains a RecyclerView with a large amount of data. For improving the app's performance I wish to implement the Paging component introduced in Android Jetpack. Since the project is pretty old, it is using SQliteOpenHelper for SQLite implementation instead of Room DB. In all of the paging examples found in related to paging using Room DB to fetch 'PagedList', so is it possible to use paging without room?

Thanks in advance.

Astha Garg
  • 1,022
  • 7
  • 21
Arun P M
  • 352
  • 1
  • 15

1 Answers1

3

It is possible, find use of Pagination library with remote api calls. Just in your case you won't make call to remote api, but to database. After you fetch data from db, you will populate datasource and voila, you have pagination. Concept in Pagination with db and remote api is the same, Room only wrapped it so you can skip 2 steps.

So yes, it is possible, you just need that two extra steps to achieve it.

Creating a custom data source for paging:

eli
  • 8,571
  • 4
  • 30
  • 40
Milan Kundacina
  • 309
  • 1
  • 8
  • 1
    I really appreciate the comment from MidasLefko and answer form Milan Kundacina as it gives proper direction to the answer. You can find the example for implementing custom paging data source here: https://developer.android.com/topic/libraries/architecture/paging/data#custom-data-source – Arun P M Nov 05 '19 at 11:57