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

Using android paging library with firebasePagingAdapter?

I am using firebase firestore as my backend. I have a recyclerView where I should load my data, I found about firestorePagingAdapter and it works fine for loading data from firestore when data is needed(when user scrolls down the list), problem is…
0
votes
1 answer

Why Does Work Manager Dispatch Multiple Observers When Using Pagination Library?

I started using the Pagination Library and wanted to execute a background task using Work Manager on the loadInitial and loadAfter callbacks from the pagination library. The issue I was seeing was there was an issue with Work Manager dispatching…
0
votes
0 answers

How to do check if ArrayList object

I am making a retrofit POST request using Paging library. When the first page is loaded the next page is automatically called. But when it comes to the last page (assume page 5), it requests for page 6, then on response the app crash with…
KIRPAL SINGH
  • 185
  • 2
  • 17
0
votes
0 answers

How to get more detail from remote server for each item got from database

I'm using RecyclerView + PagedListAdapter + Room to show the data in database. It works now. But I want to get more detail from remote server for each item got from database. How can I do?
Stony
  • 3,541
  • 3
  • 17
  • 23
0
votes
0 answers

LiveData triggers only once when paging with room

ViewModel: val eventDataFactory = AppDatabase.getInstance(context)!!.eventDao().getEventList() val pagedListConfig = PagedList.Config.Builder() .setEnablePlaceholders(false) .setInitialLoadSizeHint(10) …
user3606902
  • 829
  • 1
  • 10
  • 25
0
votes
1 answer

Android Paging library does not work with Asynchronous requests

The Android Paging Library does not work when making asynchronous network calls using Retrofit. I am using the Google's sample code for Architecture Components on Github, and modified it for my needs. I had faced the same issue previously but got…
ashwin mahajan
  • 1,654
  • 5
  • 27
  • 50
0
votes
1 answer

Android Paging Library: how to show related item if it's not in local database yet and don't break paging?

I'm writing chat app. Messages are load by pages (item keyed - message_id) using Android Paging Library. Also there is "reply" feature, which mean users can reply to any message in chat. In RecyclerView it should looks like that: Part of message…
LIFED
  • 467
  • 1
  • 4
  • 16
0
votes
1 answer

RecyclerView load 10000+ image from backend api

I get JSON data in my back-end API. [ { id: "is random" image: "my url" }, ......10000+ ] My id is random number without continuity. Each json object has image. I call api and put data in RecyclerView . But when RecyclerView is…
JerryLi
  • 99
  • 1
  • 3
  • 8
0
votes
1 answer

Android paging library + Firestore crashes with IllegalStateException

I trying to implement the new Android paging library using Firestore as my backend. I have created a class MyDataSource that extends PageKeyedDataSource, where I'm implementing three…
0
votes
1 answer

PagedListAdapter passing newItem as oldItem to DiffUtil.ItemCallback

I have added a checkbox and the paging library to Google's RoomWithAView codelab and the call to DiffUtil.ItemCallback seems to be passing the updated version of the entity to both the oldItem and newItem parameters. My checkbox checked state is…
Nick Nelson
  • 1,131
  • 2
  • 18
  • 36
0
votes
1 answer

Why does this example of paging library perform much worse than just a recycler view?

So i've been reading on Android's new paging library. Specifically, I'm trying load a list of never-ending images (with Glide) using a recyclerview with adapter, viewmodel, and data source (backed by retrofit network calls). Here's the base…
0
votes
1 answer

Android paging works not as expected

I tried to use paging in my project. Unfortunately, it works not as I expected. I expected that the liveDataObserver will work after callBack.onResult.But in fact, the liveDataObserver observes immediately when the loadInitial finished.The callBack…
0
votes
0 answers

how to use paging when recyclerview item have another recyclerview

i have a recyclerview item ,it contains an another recyclerview to show image list:
0
votes
0 answers

Paging library network error when data is loaded

I am working with paging library and I am struggling with the LiveData PagedList. My paginated list is working properly but there is an scenario where it is not. I have RecyclerView + SwipeRefreshLayout when data is already shown in the list and I…
lucasg
  • 97
  • 4
0
votes
2 answers

How to update live data value in android

I am using liveData in my application. I do a DB Query which returns a LiveData> of contacts stored in DB. I want to modify this livedata before giving it to observers. Suppose there are ten contacts in the LiveData list, i want…
Pardeep Kumar
  • 900
  • 1
  • 14
  • 30
1 2 3
34
35