Questions tagged [android-paging-library]

158 questions
18
votes
1 answer

Paging3: "Not sure how to convert a Cursor to this method's return type" when using PagingSource as return type in Room DAO

I was trying to imitate Google's codelab for the new Paging 3 library, and I encountered the following error when I tried to have a Room DAO method return a…
13
votes
3 answers

How can I Unit test Paging 3(PagingSource)?

Google recently announced the new Paging 3 library, Kotlin-first library, Support for coroutines and Flow...etc. I played with the codelab they provide but it seems there's not any support yet for testing, I also checked documentation. They didn't…
MR3YY
  • 302
  • 1
  • 2
  • 11
12
votes
1 answer

How to implement paging in Leanback VerticalGridSupportFragment using Paging Library?

We are trying to implement paging in Leanback VerticalGridSupportFragment with Architecture Components Paging Library. Leanback on it's own doesn't have any sort of out-of-box compatibility with Paging Library so we extended it's ObjectAdapter class…
7
votes
2 answers

How can we get entire object list passes to the PagingDataAdapter while using Paging library 3.0?

I am new to the paging library 3.0, I need to paginate data only from the local database. Initially, I fetched PagingSource from the database and use it as flow. fun getChatMessages(chatWrapper: ChatWrapper):…
7
votes
0 answers

Paging Library Callback.OnResult Not Returning Value To Livedata

I wanna to implement jetpack paging library. everything seems working, after getting response from api (using Retrofit2 and coroutine) android paging callback is calling his onResult interface. but it's not returning it's value to livedata in main…
7
votes
2 answers

LiveData Paged List size is always 0

I implemented Paging using android paging library. The ViewModel returns a LiveData> and I observe that in the fragment where I set the adapter and everything is working good, except that when I want to check the size of the list…
6
votes
1 answer

Android Jetpack Paging 3: PagingSource with Room

I'm using latest Jetpack libraries. Pagination3 version: 3.0.0-alpha05 Room Version : 2.3.0-alpha02 My entities have Long as PrimaryKey and Room can generate PagingSource for other than Int type. error: For now, Room only supports PagingSource with…
6
votes
0 answers

"Channel was closed" message when using Paging 3 from androidx

I have tried to convert my Paging 2 implementation to Paging 3 with Flow in my app, but are plagued by a "Channel was closed" Exception. The app works fine, but crashes after some time (from a few seconds up to many minutes). It loads data from web,…
6
votes
2 answers

RecyclerView remains empty with Paging Library and PositionalDataSource

I am trying to configure the Android Paging library in my project to load a paginated list of messages into a RecyclerView. Since my API uses offset and max, I'm using a PositionalDataSource. Here is my DataSource implementation, where DataStore is…
6
votes
0 answers

Android PageKeyedDataSource (paging library) callback error handling (there is TODO exception in src)

I want to pass an error exception to my paging adapter via callback.onError(or callback.onRetryableError) in loadInitial or loadafter but always receive crashes. After some debugging I find this in library sources: It's actually what I'm receiving…
6
votes
5 answers

How to clear/remove all items in page list adapter

I'm using the android paging library to show search result items, is there any way I can clear/remove all the loaded result items, Calling Invalidate on live Paged List refreshing the list not clear/remove items In Activity: fun…
Sam
  • 5,427
  • 7
  • 64
  • 78
5
votes
2 answers

How to check the list size or for empty list in Paging 3 library

I've been able to successfully implement the new alpha07 version of Paging 3 library by following the instructions available here: https://developer.android.com/topic/libraries/architecture/paging/v3-paged-data#guava-livedata However, now I am in…
Shadow
  • 2,867
  • 4
  • 28
  • 56
5
votes
4 answers

Paging library 3.0 : How to pass total count of items to the list header?

Help me please. The app is just for receiving list of plants from https://trefle.io and showing it in RecyclerView. I am using Paging library 3.0 here. Task: I want to add a header where total amount of plants will be displayed. The problem: I just…
5
votes
1 answer

Android Paging 3 doesnt show Loadstate Adapter

I have followed a tutorial to add Loadstate Adapter to the Recyclerview Adapter on Android Paging 3 but currently, it's not showing. This is how I am updating the Adapter. lifecycleScope.launch { viewModel.searchProducts(searchParam,…
5
votes
2 answers

How to restore recyclerview scroll position when using PagingDataAdapter?

I have an App that fetches a list of 158 Items from an API, stores it in Room, and displays it to the user. RoomDB is the source of truth. This is the code on my ViewModel that gets the result from the database: private val pagingConfig = …
1
2 3
10 11