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

PagingDataAdapter submitData slow down UI

I'm using Paging 3 to load a list of items from room database but that slow down my app and UI looks very leggy Here a look how i am using it mViewModel.messages.observe(viewLifecycleOwner) { …
0
votes
1 answer

Is it possible to display chat messages through the Android Paging Library?

I want to merge two message list(stored chat message, incoming chat message) these two data is split based on the last check time. I want stored chat message to be Paging and merge with incoming data This is my code: @Query("SELECT * FROM msgentity…
0
votes
0 answers

How to use RemoteMediator while loading from a local cache?

I am implementing a use-case where I am using Paging library to load a list of Books from my remote api. The remote api gives a list of Books for a particular page number.I am adding a simple local cache using a Map data structure to cache the list…
0
votes
1 answer

My paging source always starts from my pageSize instead of 1

I need my start distance at first request to be 1 , then I need it to be 101 and then 201 and so on, my limit should always be 100, but I have tried everything in the PagingConfig and I cannot get this behavior , here are 2 images of what I get and…
SNM
  • 5,625
  • 9
  • 28
  • 77
0
votes
4 answers

LazyColumn error: LazyPagingItems required but found List

I'm using the Paging 3 library with LazyColumn and I want to sort the list according to the category of shopping list items. In the code below, LazyColumn complains that it's expecting LazyPagingItems for the items property but…
0
votes
1 answer

Api Call With Paging 3 Not Getting Triggred [ Closed ]

I am trying to make an api call with paging 3 and retrofit. But for some reason the api call is not getting triggered. I checked my code multiple times to find an issue but couldn't understand why am I doing wrong. When I make that api call…
0
votes
0 answers

Replacing Pager Data in RecyclerView

I have a fragment that is the profile page of the user. The profile page will display the user's posts, however, there's another button on that page that will display which posts the user has liked. ProfileFragment: override fun onViewCreated(view:…
user2896120
  • 3,180
  • 4
  • 40
  • 100
0
votes
0 answers

Switch to context thread

I'm using descendant of PageKeyedDataSource. In its loadInitial, rx chain is running. When I specify no schedulers for the chain, it's running whatever background thread body of loadInitial is executed at. Let's imagine the chain needs to switch to…
ror
  • 3,295
  • 1
  • 19
  • 27
0
votes
1 answer

Paging data is refreshing on navigation in jetpack compose

I'm getting some data from my database like this Pager(PagingConfig(pageSize = PAGE_SIZE)) { songRepo.getSongs() }.flow.cachedIn(viewModelScope) and I collect it in the UI using collectAsLazyPagingItems(), but whenever I navigate to…
0
votes
1 answer

Paging 3, recycler view flickers when i call adapter.retry on footer load state

pagination seems to work well, but when disconnect the internet and call adapter.retry everything works as expected, except that the recycler view flicks, here's a video https://youtube.com/shorts/9Fw9VyEPGLE?feature=share I followed android paging…
0
votes
0 answers

PagingSource does too many requests

I have implemented search using PagingSource and PagingDataAdapter. While scrolling, PagingSource does too many requests, unclearly why, because I have few more PagingSources in other fragments that work…
0
votes
1 answer

Cache flow in ViewModel

I have a ViewModel @HiltViewModel class GreetingCoverScreenViewModel @Inject constructor( private val repository: PersonalizationRepository ) : ViewModel(){ fun getIllustrations(occasionCode: String): Flow> =…
0
votes
1 answer

Jetpack compose paginated list UI updation on item Click

How to make UI changes in a paginated list with jetpack compose. Use case I have a paginated list which has data name(string) and like(boolean). If i click on the particular item in the list, i need to place a like button in the UI. But the image is…
0
votes
0 answers

How to update options in Firebase Paging Adapter?

I am using Firestore Paging Adapter to display posts from Firestore. Initially it shows all the posts. I want to add button that will filter posts, for example for particular date. query = firebaseFirestore.collectionGroup("posts") …
0
votes
1 answer

Android paging library without using page number but with explicit next set of ids

Android paging library's PagingSource uses key like PagingSource where the first parameter is the page number. What if the server, instead of using a page number, returns (for each request) a list of items ids the client should request…