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

Firestore pagination multiple queries

After reading firestore doccumentation and some article I found out this library 'android.arch.paging:runtime:1.0.0-alphal4-1' for pagination. it works good but now my problem is that i want to pass two queries in my pagination. I tried some stuff…
0
votes
1 answer

Paging3 with ViewPager not working (where pages use the same type of PagingSource)

I'm trying to use Paging3 with ViewPager in a project, but something strange is happening. I think it is due to the fact that each page uses the same type of PagingSource. Here's how the page is structured: Main Fragment View Pager Cars Fragment…
0
votes
1 answer

Setting the scrollState when listing a lazyColumn

To draw data using the paging and jetpack composite libraries, I use the LazyColumn(). The data comes in every second and I need to stop the view on the elements when I go down. Now they go lower when adding fresh data at the top of the list. How i…
Sunbey13
  • 339
  • 4
  • 12
0
votes
1 answer

How to pass MutableLiveData from function to Pager?

I am trying to use my search function with Paging 3. I checked my addQuery() function and my _repoQuery value is not null there when I do a search. But when I try to pass the value to the Pager {}, it is always null. I know that because it always…
Code Poet
  • 6,222
  • 2
  • 29
  • 50
0
votes
0 answers

I am using mvvm and I want to pass an id through intent to my retrofit function in my paging source class

I want to pass an id which is coming from intent to my retrofit function in paging source class which is part of android jet pack paging. someone please tell me how can I do this. A detail help would be appreciated. Paging Source Class class…
Muaz Khan
  • 27
  • 6
0
votes
3 answers

Could not get unknown property 'implementation' for object of type Dependency

Hello there after adding dependency of paging val paging_version = "3.1.0" implementation("androidx.paging:paging-runtime:$paging_version") I'm getting this error Could not set unknown property 'paging_version' for object of type…
Vasant Raval
  • 257
  • 1
  • 12
  • 31
0
votes
1 answer

How to call different api resource from paging source or remote mediator Kotlin

Hey I want to call two different api for my Paging Library 3. I want to ask what is best suit for me to use Paging Source or Remote Mediator?. What is the use case of both? Can someone please explain me. For 1st api call only for single…
0
votes
3 answers

How to tell if jetpack-compose pagination is working?

How can you tell if paging is working properly? All the examples I've looked at involve using retrofit apiservice which appears to be returning pages of data, but I'm pulling down a single rss feed and parsing it into a giant List. I suspect…
dbarnes
  • 439
  • 1
  • 3
  • 11
0
votes
0 answers

Observe not called with LiveData when we start observing the LiveData before LivePagedListBuilder() is called

I'm using the PagedList architectural components using a custom Paged datasource and I am having trouble returning results to the observe method. below doesn't work: fragment onviewcreated method override fun onViewCreated(view: View,…
0
votes
1 answer

Show Header when Swipe to Refresh with Jetpack Paging3 Android

Problem Statement: Using Paging3 library and need to show loading information in header when user swipes to refresh. I followed the sample provided in the here. Solution: Tried adding refresh header in LoadStateAdapter for with using…
0
votes
1 answer

Is it possible to use clipToPadding in a ViewGroup for only the top padding?

So basically I have a chat recycler view. And there are some bottom chips that show on top of the chat at times, now what I want is to fade the chats from the top but show the chat items on the bottom (even behind the chips). Essentially what I want…
0
votes
1 answer

Is there a better way to update recyclerview in paging3 with room?

in my fragment lifecycleScope.launch { viewModel.capture().collectLatest { adapter.submitData(it) } } Now when I update the item in…
pnkj
  • 406
  • 5
  • 17
0
votes
0 answers

Using Paging 3 to paginate a list with a startRecord and an endRecord

I am using paging 3 and cannot find my use case in the available tutorials. basically I paste is the example i find in the documentation and in all the tutorials on line, basically backend.searchUsers(query, nextPageNumber) does not fit my case I…
0
votes
1 answer

How to continue paging after swipe to refresh error?

I am implementing swipe to refresh with the PagingLibrary 3.0. My repository returns a flow of PagingData which is then exposed as LiveData by a viewmodel. Repository override fun getItems(): Flow> { val pagingConfig =…
0
votes
1 answer

Is there a way to convert a List to a PagedData while the backing paging source data doesn't use room db

I do have a paged data source that returns a PagedData data that is displayed with the pagedAdapter after initial load from SQLite. After some server transactions,I receive a list of List and after transforming and caching it need to display…
cap_muho
  • 63
  • 7