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
0 answers

Android Paging library, Recyclerview, Retrofit, MVVM

I'm trying to build an app with Android Architecture Components. I'm using TMDB API in my app. In my app, a user searches for a movie or series and gets the result. I've achieved this but I want to get all the pages from API with Paging library.…
Murad
  • 104
  • 1
  • 1
  • 10
0
votes
2 answers

ViewModel is duplicating items for recyclerview

I am using Firebase firestore pagination and ViewModel class in my project, I have setup an onScroll listener for recyclerview, and fetching data on scroll but when i Navigate to another fragment and back to the main fragment, the whole items are…
0
votes
0 answers

Need Callback When more page load in Pagedlist Android

I have Implemented the RecyclerView with PagedList. As per Documentation The Paging Library's key component is the PagedList class, which loads chunks of your app's data, or pages. As more data is needed, it's paged into the existing PagedList…
Umesh Saraswat
  • 560
  • 1
  • 8
  • 22
0
votes
1 answer

Creating another PagingSource for a different API resource?

Suppose I have a API resource that displays a list of animals, let's call it /animals, and I have another that is used to search the list of animals using their species, /animals/{species}, if I were to use Android's new Paging3 library, would I…
Alvin Dizon
  • 1,855
  • 14
  • 34
0
votes
0 answers

Android Paging Library V3 can't handle return type

I'm using Paging Library v3 and I'm getting this error when trying to use the RxRemoteMediator error: Not sure how to convert a Cursor to this method's return type (androidx.paging.PagingSource). Here's the…
avillagomez
  • 443
  • 1
  • 8
  • 18
0
votes
1 answer

Android jetpack paging3 update item

I am using paging3 to display data. When I want to update a few items, how do I get the position of these items? use "notifyItemChanged".(I know the id of these items, but there is no api to get the adapter data)
0
votes
1 answer

Fragment takes time to load RecyclerView when the list is large

I have a RecyclerView implemented along with Paging to load a list from Room Database. The list works fine when the size is small. When the size reaches around 50 - 60, the list still works fine but when i switch to another fragment and then come…
0
votes
1 answer

PagingDataAdapter.submitData not adding data

I'm using Paging 3 from the jetpack libraries, after inserting a data to room db, collectLatest gets called but after adding data with PagingDataAdapter.submitData, it doesn't seem to add to the adapter. I tried using adapter.refresh and…
0
votes
1 answer

@PrimaryKey of Room Table creates an unexpected behaviour in Android Paging

I am implementing Paging with cache using Room database by following this codelab tutorial : - https://codelabs.developers.google.com/codelabs/android-paging/#13 However while implementing the caching part, I have come across some strange behaviour…
0
votes
2 answers

Android pagination for search query

I am new to android development and trying to build the UI for my application. The app integrates with REST backend which accepts a search query and a list of items as response. interface RetrofitEndpoint { @GET("paged/list/endpoint") …
0
votes
1 answer

How to remove dropped items from RecyclerView in Android Pager 3?

I'm using Android Paging 3 library. In my testing configuration it has a PagingConfig with pageSize = 10 and maxSize = 40. When I scroll down the configured RecyclerView, everything works as expected - new portions of data are loaded when I'm…
Andrei K.
  • 534
  • 7
  • 20
0
votes
1 answer

Android Paging library Index out of bound exception

i am implementing paging library in android all works fine if item of all pages are the same. When item of last page items size is 1 rather then 10 it gives a exception. i am using paging library 2.1.1 with androidx. Exception E/AndroidRuntime:…
0
votes
1 answer

Questions regarding Jetpack Paging

I have some questions regarding Jetpack Paging. First question, does the server needs to support the paging feature for frontend by creating an endpoint that keeps track of how many items that have already sent to the frontend? There are not much of…
0
votes
2 answers

Android PagingLibrary network + database

I'm working on Messaging app and I am implementing database + network to save chat messages from api and show them from database. I'm using BoundaryCallback to fetch message when database has no more data. My api works like this: getlist( …
0
votes
1 answer

PositionalDataSource refresh on Android

I'm using the PagingLibrary and also implemented the PositionalDataSource, I'm not using Room in this case since my DB was already declared by other developers and I don't want to migrate to Room right now. Instead, it is using GreenDao as a wrapper…
Elior
  • 3,178
  • 6
  • 37
  • 67