Questions tagged [android-paging]

The Paging Architecture Component makes it easier for your app to gradually load information as needed from a data source, without overloading the device or waiting too long for a big database query.

Overview:-

Many apps work with large sets of data, but only need to load and display a small portion of that data at any time. An app might have thousands of items that it could potentially display, but it might only need access to a few dozen of them at once. If the data is stored or synchronized with a remote database, this can also slow the app and waste the user's data plan

While existing Android APIs allowed for paging in content, they came with significant constraints and drawbacks:

  • CursorAdapter makes it easier to map database query results to ListView items.
  • AsyncListUtil allows for paging position-based data into a RecyclerView but doesn't allow for non-positional paging, and it forces nulls-as-placeholders in a countable data set.

Classes:-

The Paging Library provides the following classes, as well as additional supporting classes:

  • DataSource: Use this class to define a data source you need to pull paged data from.
  • PagedList: This class loads data from a DataSource. You can configure how much data is loaded at a time, and how much data should be prefetched, minimizing the amount of time your users have to wait for data to be loaded.
  • PagedListAdapter: This class is an implementation of RecyclerView.Adapter that presents data from a PagedList.
  • LivePagedListProvider: This class generates a LiveData from the DataSource you provide.
524 questions
1
vote
0 answers

PagedList.BoundaryCallback is not triggered again

I am trying to implement Paging with room and network call as shown in android sample onItemAtEndLoaded is called when I move to the bottom of list. In that case I insert data into room by getting result from network call. If network call fails,…
1
vote
1 answer

How to restore recyclerview position on screen rotates when using PagedListAdapter

I am using PagedListAdapter and PageKeyedDataSource from android paging library. I want to restore recyclerview position after screen rotates. How can I achieve this? setInitialLoadKey on LivePagedListBuilder doesn't effect to PageKeyedDataSource.
1
vote
1 answer

Debugging pagination with Paging Architecture Component

So I wrote a simple notes functionality with the paging library using LiveData and Room database but I don't see it actually paginating anything. Perhaps I am not debugging correctly to confirm that pagination is happening. Any advice is…
1
vote
0 answers

Android cache with CRUD

I am working on a social-networking-type app where the user sees a list of "posts" and can interact with them, notably they can "like" them. The list of posts is in the 10,000s and so we paginate it using Android's paging library (DB + Network), but…
d370urn3ur
  • 1,736
  • 4
  • 17
  • 24
1
vote
1 answer

Proguard problem with example of Paging library usage (in Google Codelabs)

I cloned solution branch of Android Paging codelabs project and then opened it via my Android Studio (v3.1) locally. The only changes I made before opening it would be modifying version codes of plugins and libraries to make them compatible with my…
Mir-Ismaili
  • 13,974
  • 8
  • 82
  • 100
1
vote
1 answer

Can loadInitial() be blocking when loading data from API

How to use loadInitial in the paging library? I am wondering If I could use a blocking call in loadInitial() to get the response from API. By doing this, I can make sure the returned pagedList contains the first page. Is it the correct way to use…
Cody
  • 4,353
  • 4
  • 39
  • 42
1
vote
1 answer

My onItemAtEndLoaded is getting triggered after the onZeroItemsLoaded

I have this strange behavior where the onItemAtEndLoaded is getting triggered after the onZeroItemsLoaded so the recycler view keeps loading and does not stop. I have the project in the GitHub can someone please help me, I spent days in this. Can…
José Nobre
  • 4,407
  • 6
  • 20
  • 40
1
vote
0 answers

Need AndroidArchitecture Paging Library to continue fetching pages after sending it an empty list

I'm using AndroidArchitecture Paging Library 1.0.0 successfully with a PageKeyedDataSource. But, my service will sometimes return an empty list even though subsequent pages will have items. In loadInitial method, I call: callback.onResult(emptyList,…
1
vote
3 answers

how can drag item in RecyclerView work with paging library together?

My app has a RecyclerView which support drag items to change their order. My app use ViewModel, Lifecycle, Room before adding paging library. And code to handle drag is easy. override fun onMove(recyclerView: RecyclerView, viewHolder:…
Zebulon Li
  • 540
  • 4
  • 21
1
vote
0 answers

Difference between AsyncListUtil and Data Paging library?

Android introduces a new paging library which is Data Paging. Previously we had the AsyncListUtil class which works with RecyclerView for handling asynchronous data loading. Data paging also work with RecyclerView as well and doing the same task as…
1
vote
1 answer

What's the purpose of the method onItemAtFrontLoaded() for paging library BoundaryCallback?

I just had a look at the paging library and I found the BoundaryCallback has three methods. For one of the methods named onItemAtFrontLoaded(), the documentation says Called when the item at the front of the PagedList has been loaded, and access has…
rookiedev
  • 1,057
  • 2
  • 9
  • 21
0
votes
0 answers

Paging3 and request to fetch data not being invoked

What I want to do: I want to fetch data from API and display it in recyclerView using Paging3 library What is the issue: The issue is that when I try to invoke fetching data from API using Paging3 library, the request isn't being invoked. I've…
0
votes
0 answers

API Not call with Paging Library in Android-Kotlin

I'm trying to api call via paging but it's not calling. Here is my code but main things is I tried to print logs while until repository log printed and from pagingsource not any log printed that means API not calling. and when I tried to call this…
0
votes
0 answers

refresh paging when update item and hold scroll with placeholders

I have a notification list displayed through paging. When I delete or change the status of an item, I want to refresh the page so as not to lose the item when scrolling to another page. I have used a placeholder to hold the place when refreshing and…
0
votes
0 answers

Paging3 in android how come uses inefficient offset limit pagination

Most efficient pagination is keyset pagination as per: https://www.citusdata.com/blog/2016/03/30/five-ways-to-paginate/ I was curious how come paging 3 library uses the inefficient offset limit pagination and not keyset pagination or is it optimized…