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

Can I modify the data set of a PagingDataAdapter using peek()?

I am looking for a way to update specific items in my PagingDataAdapter from the Paging 3 library. The recommended way at the moment seems to be to invalidate the PagingSource but this causes the adapter to fetch the whole data set again, which is…
Florian Walther
  • 6,237
  • 5
  • 46
  • 104
0
votes
2 answers

Kotlin - PagaingDataAdapter; Remove Item at position

in my app I'm currently using retrofit and getting a list of movies based on a search query from the user. From there, the user can swipe the movie from the list that comes up to add it to their watchlist. I had this working with a normal…
daniel-eh
  • 344
  • 3
  • 13
0
votes
0 answers

Using AndroidX Paging for non UI paging (e.g. in Services)

The Paging docs start off with: The Paging Library helps you load and display small chunks of data at a time. Loading partial data on demand reduces usage of network bandwidth and system resources. source It's still unclear to me if Paging would…
Ben Butterworth
  • 22,056
  • 10
  • 114
  • 167
0
votes
1 answer

Recycler view comes to initial item when the next page of items are loaded

I have done paging for my recyclerview to fetch items from api using volley, i have tried a solution which is already asked , but what i am facing is when a new items are loaded from next page means, page refresh and loads from a start, so can…
0
votes
1 answer

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

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…
0
votes
1 answer

What does the initialKey parameter do in the Pager constructor

I am trying to understand what the initialKey does in the Pager constructor, but I cannot find any sort of explanation, not even in the official…
Shadow
  • 4,168
  • 5
  • 41
  • 72
0
votes
1 answer

Why PagedList adapter loading all data irrespective of pagesize?

I have set the page size to 10, The page size in the observer is giving the right size, but all the items from the database(ROOM) is getting loaded to the view holder The boundary call back onItemAtEndLoaded is getting called with the last item in…
0
votes
1 answer

Identical Retrofit call throws Unable to create call adapter error while the other one works

I am trying to setup Paging 3 with Retrofit and I am unable to get past this call. val response = redditAPI.getSubreddits(mBearer, mWhere, position, params.loadSize) The getSubreddits method is this @GET("/subreddits/mine/{where}") fun…
Kostas Andrianos
  • 1,551
  • 2
  • 16
  • 21
0
votes
1 answer

Kotlin: CoroutineScope is collecting data even after flow is cancelled

I am trying to launch an Coroutine inside my PagingSource in order to watch how long my paging source is already trying to get my data. The only problem I have here is, that my Coroutine is still somehow collecting some data, even after I stopped my…
Andrew
  • 4,264
  • 1
  • 21
  • 65
0
votes
0 answers

How to paginate live data that i am taking from cloud firestore?

I am building a chat app and displaying the text messages with the code below.I wanna know how i can paginate this live data that i am getting from cloud firestore so that a user can only look at the past say 30 messages using the paging 3.0…
0
votes
1 answer

Display empty state when using Google's Paging3 library

I'm currently using Google's Paging3 library for the first time. I'm basing my code on their Codelab at https://codelabs.developers.google.com/codelabs/android-paging/#0. The flow of my app adheres to the following rules: display empty state let…
susosaurus
  • 459
  • 10
  • 28
0
votes
1 answer

Non-infinite paging

I'm using the newest Paging 3 library and trying to implement non-infinite paging by using PagingSource class which executes requests to my API. What do I want to do? When the user scrolls to the end of RecyclerView list instead of automatically…
flyingAssistant
  • 872
  • 7
  • 19
0
votes
1 answer

OnItemAtEndLoaded() called infinitely even when not at bottom of list

In my implementation of Android paging library 2.0, the OnItemAtEndLoaded() is called numerous times even when not scrolled to the bottom of the list. The call keep on going without stopping. The Episodes received from the API call are ordered by…
atmko
  • 11
  • 1
0
votes
0 answers

How to update specific item in paging list

I am using a paging library for android to load data from a web server and show it in a list. Facing a problem with "add to favorites" functionality. To do so, I have to send a pull request to my webserver after which I have to update that specific…
0
votes
0 answers

How can I track the status of each API call that was made by the user for each single item inside PagedListAdapter?

hope you are not having a bad day.:D I am retrieving posts from the server with pagination which I have done smoothly using Paging Library. The user can like the post or follow the poster, my problem is that I want to handle the 'follow' or 'like'…