Questions tagged [android-paging-library]

189 questions
1
vote
1 answer

loadAfter() in Android paging library infinitely loading the first page from API

I'm implementing the paging library 2.1.2 in my Android app, my DataSource class looks like this public class TransactionsDataSource extends PageKeyedDataSource { private static final int FIRST_PAGE = 1; private Context…
Michael
  • 411
  • 2
  • 6
  • 15
1
vote
1 answer

How can I implement Paging library 2 Boundary Callback using Coroutines?

I want to implement my custom PagedList.BoundaryCallback with coroutines, liveData and repository pattern using Paging Library 2, but I couldn't find a good example of integration of these libraries. Even in Android official samples, they use…
Andy
  • 751
  • 1
  • 12
  • 25
1
vote
1 answer

Android Pagination 3.0 not able to search after first try using kotlin flows

So, I have a pager setup using kotlin flows in android. I have a string that I get from the user and whenever that changes I use the flatmaplatest operator to get the latest item from the Pager object. The pager object is as follows. fun…
1
vote
1 answer

Android Paging 3 library, grouping items

We are developing a chat application. If messages contain images, and they come one after another, we in adapter group these images in one message. Question 1 In the database, and in the rest of API we have these messages separately, but in the…
1
vote
2 answers

Loading new items after showing progressbar with paging library 3

I have implemente paging library 3 and it works and shows data , what i need to implement is loading more feature , so when the user scrolls down , it fetch a page 10 items , so basically between loading of new data i want to show a progressbar at…
Taki
  • 3,290
  • 1
  • 16
  • 41
1
vote
0 answers

Android paging and grouping models

I have MVVM-like architecture, data flow is the following: I have data (image src url + linked data) in SQLite I have Repository layer and method like this: fun getPhotos(): LiveData> I'm using androidx.paging library v.2…
1
vote
0 answers

Android Paging library 3 throws exception when a new item is inserted while scrolling

I am developing an Android chat app with Paging library 3 androidx.paging:paging-runtime-ktx:3.0.0-alpha12 The paging library retrieves chat messages from the Room database. When I insert a new chat message to the ChatMessage table in the Room…
1
vote
0 answers

How to reset the scroll position after process death when using Paging 3 with RemoteMediator

I have set up Paging 3 with offline caching using a RemoteMediator. After process death, the RecyclerView immediately restores the correct scrolling position. However, since we need to send the search query again it triggers a LoadType.REFRESH which…
1
vote
1 answer

onRestoreInstanceState not working for RecyclerView layout manager if using Paging 3 library

I had a problem in saving RecyclerView state and it solved by saving layout manager state and using it after resume fragment.(thanks to @HarisDautović) class TestFragment : Fragment() { private val testListAdapter: TestListAdapter by lazy { …
1
vote
1 answer

"IllegalArgumentException: Layer is redrawn" while scrolling too fast using collectAsLazyListItems() with JetpackCompose paging

I use Flow>.collectAsLazyPagingItems() extension method in my composable. The flow originates from a RemoteMediator, I'm using local and remote data sources. It crashes only when I scroll fast, it does not happen when scrolling…
Ziv Kesten
  • 1,206
  • 25
  • 41
1
vote
1 answer

Firestore pagination with Jetpack Paging 3 - startBefore not loading the correct page

This is my attempt at paginating a collection of Firestore chat messages with Paging 3. It correctly loads the next pages, so the startAfter operator seems to be working as expected. But it's not loading previous pages correctly. Instead, it always…
1
vote
1 answer

How to cache PagingData in a way that it does not cause its data to reflow

I have a simple setup of 2 fragments: ConversationFragment and DetailsFragment I am using Room with Paging 3 library and to populate the ConversationFragment I am using a PagingLiveData implementation together with a AndroidViewModel belonging to…
1
vote
1 answer

Paging 3 - IllegalArgumentException: Additional prepend event after prepend state is done

After making a simple app with Paging 3 (based on this Google GitHub codelab) my app crashes. When I scroll down, at some point (probably when the new GET function is called). Logcat looks like this: D/NewsRemoteMediator:…
iknow
  • 8,358
  • 12
  • 41
  • 68
1
vote
0 answers

How to add checkbox when using Android Paging Library & Room

I'm using Android Paging Library + Room Library. @Entity data class Customer { @PrimaryKey(autoGererate = true) val id: Long, val name: String } @Dao interface CustomerDao { @Query("SELECT * FROM Customer") fun get():…
1
vote
1 answer

Android Paging Library: How to intelligently switch Between online and offline data?

I am following this tutorial by Raywenderlich on paging-library-for-android-with-kotlin on how to use android paging library. This is one of the easiest tutorials on the net and I have followed it thoroughly. However, I would like to make some…