How to submit non pagingData(just list of objects) to PagingDataAdapter?

1.6k Views Asked by At

I just implemented pagination with paging 3 library. So, I did everything according to documentation.

From backend I query a list of Posts, and it comes paginated with next and prev keys, that's why I decided to use paging 3. Then, after converting it PagindData in viewModel, I submitted it to adapter using submitData. Ok, but I have i spinner which shows a category list, and I want to display posts by category. Posts by category also comes from backend, but it is not paginated it comes just as a list of objects. And question is how to pass this list of posts by category to my recycler view which works with PagingData? Should I convert posts by category to pagingData ? Thanks.

1

There are 1 best solutions below

0
On

To send a static list you can use PagingData.from(list), but if your list isn't paginated, Paging might just be unnecessary complexity for that part of your app!