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
1 answer

Firestore pagination last visible document throws out of bound exception

Have tried to use Firestore pagination by using these links https://stackoverflow.com/a/50742175/4232013 but i facing a ArrayIndexOutOfBoundsException suddenly after some added documents in collection can any one help me to point out where i am…
1
vote
0 answers

List size + position too large, last item in list beyond totalCount

I'm trying to get device contacts using paging library (3.0.0-alpha02 version). But when I try to invalidate the data source I get this exception: java.lang.IllegalArgumentException: List size + position too large, last item in list beyond…
Soroush Lotfi
  • 452
  • 4
  • 14
1
vote
1 answer

Android Pagination Library wont stop loading items in recyclerview

I am using Android Pagination Library... It's working in a weird way - Items keep loading infinitely, there is no stop even when there are no more data to load. For example, I have 2 Items to load, instead of loading just the 2 items and stop…
Ibramazin
  • 958
  • 10
  • 30
1
vote
1 answer

Disposing Observable Inside Android Paging Library Data Source

I want to observe my network call changes inside my PageKeyedDataSource and Dispose of the RxJava subscription after user quitting a Fragment which leads to Data Source destruction. class ProjectDataSource : PageKeyedDataSource
Arrowsome
  • 2,649
  • 3
  • 10
  • 35
1
vote
1 answer

Unexpected behaviour with paging library

I started to learn about the paging library, And I've a problem. I'm able to fetch the data and show inside my recyclerView, But I've really weird beahviors. I Put logs on loadInitial, loadBefore and loadAfter and the first time loadInitial and…
ScrapeW
  • 489
  • 8
  • 16
1
vote
0 answers

Android Paging Library scrolls list to the top while invalidating

I am new to the paging libray, whenever i was invalidating the data source, paging brings the list to the top. I was searching through various blogs they were saying that loadInitial,loadRange should be called from the thread where it was started,…
Stack
  • 1,164
  • 1
  • 13
  • 26
1
vote
1 answer

Android Pagination Library: RecyclerView jumps to the top when loadAfter called

I am using a Androidx Paging library with RecyclerView for pagination in my view. The issue I am facing is when I scroll down RecyclerView, after the mentioned number of PAGE_SIZE, loadAfter is called and once the new data is received, my…
Aanal Shah
  • 1,946
  • 2
  • 20
  • 30
1
vote
1 answer

Android Paging Library Doesn't Scroll Up Correctly

I'm using the JetPack paging library with a network call (no database). I am able to scroll down smoothly and load new pages of data, BUT, when scrolling up it stutters and quickly jumps to the top of the list. I am unable to scroll up…
Tin Nova
  • 11
  • 3
1
vote
0 answers

How to show new data in nasa apod api with boundarycallback paging library in android?

I'm making an app with NASA APOD api with paging library. I use boundarycallback class for caching. My problem is that when there is already cached apod items in the database from yesterday, the new pictures won't show in the recycelrview unless I…
user12779999
1
vote
1 answer

Implemating RecyclerView containing multiple view type with andoid Paging library

My goal is to populate a recycler view with at least two different types of data. First item of the recycler view is a another recycler view that can scroll horizontally. The rest of the items can scroll vertically. Data is backed by room database…
1
vote
0 answers

Android Paging Library Loads very slowly for the first time and also when Filter is applied

In my Application I am Having 1,46,000 Records,while applying paging Library the Data is Loading after 10 - 15 seconds.While applying Filter on the Loaded Records it takes minimum 5-10 seconds to Load.The Filter opearation is quiet good before…
1
vote
1 answer

Room DataSource.Factory with multiple view RecyclerView

I have the following SELECT on the DAO @Query("SELECT * FROM todo ORDER BY time DESC") abstract DataSource.Factory getAll(); I have a repository that just returns the above. And in the model I have PagedList.Config config = new…
Idrizi.A
  • 9,819
  • 11
  • 47
  • 88
1
vote
1 answer

Creating a generic PagedListAdapter using android paging library

My app has more than 4 lists of different data models. I want to create a more generic CommonAdapter that extends PagedListAdapter Here is my current code public abstract class CommonPagedListAdapter
ovicko
  • 2,242
  • 3
  • 21
  • 37
1
vote
0 answers

Image automatically set to recyclerview items those having no images in data after scrolling when using pagination

when using pagination in recyclerview functionality woking fine, but after scrolling recyclerview images set to all recyclerview items those having no image data from api. How to avoid it.. I will attach my adapter and activity code. Adapter…
Akshay Kondekar
  • 126
  • 1
  • 9
1
vote
0 answers

How to add a single item to a PagedList using RxJava

My project is using Google's paging library to load some stuff into a RecyclerView. We use RxJava paired with an Apollo GraphQL query to get the data which works fine. However, we also setup a GraphQl subscription to get new items as they come in,…
Dannyt94
  • 11
  • 3