Paging with Paging 3

Android Developers · 58K views · 2020 · 11:07

Open on YouTube

Software architecture & designSoftware (other)talkdated

Why Stack Overflow recommends it

Stack Overflow users link it as the official walkthrough of the Paging 3 architecture, especially the network plus local database pattern, and as background when explaining how it differs from Paging 2.

Recommended by 1 people across 1 different months, 2020 to 2022.

What it is

A short Android Developers talk by Florina Muntenescu introducing Paging 3.0, the Kotlin coroutines-based rewrite of the Jetpack Paging library. It covers the main components, how they fit into an existing app architecture, and how to add common features like error handling, list transformations, separators, headers and footers.

What people said

Recommends dlam · 2020-07 · Stack Overflow · on “Difference between PagingDataAdapter and PagedListAdapter in Android Paging Libray Architecture Component”

PagingDataAdapter is the Paging3 replacement for PagedListAdapter , it was rebuilt from the ground up to be Kotlin + Coroutines first, and supports synchronously reacting to LoadState + Errors (Paging2 didn't have these concepts built in), reactive transformations (including separators, LoadState-aware headers / footers via ConcatAdapter ), and request de-duplication on top of a simplified API compared to Paging2. To use PagingDataAdapter , it needs to hook up to the other Paging3 constructs via Pager , but all of these were built with backwards-compatibility with Paging2 in mind, so you can incrementally migrate from an existing project. e.g., Pager requires a () -> PagingSource<Key, Value>

Cites shoheikawano · 2021-02 · Stack Overflow · on “Android Jetpack Paging 3: PagingSource with Room”

Since you have 'refresh' scenario and using Room db, I am guessing you are using Paging3 with network+local db pattern(with Room db as local cache). I had a similar situation with network + local db pattern. I am not sure if I understand your question correctly, or your situation is the same as the one I had, but I'll share what I did anyway. What I was using: Paging3: 3.0.0-beta01 Room: 2.3.0-beta02 What I did was let Room library to create PagingSource (with the key of Int ), and let RemoteMediator [LINK] handle all the other cases, such as fetching the data from network when refreshing and/or appending, and inserting them into db right after fetch success. My dao function for creating Pag

Cites southerton81 · 2021-03 · Stack Overflow · on “Endless RecyclerView with ProgressBar for pagination”

Another possible solution is to use the ConcatAdapter available from RecyclerView 1.2.0. The drawback is that this library version is yet in alpha. Using this approach, separate adapter is used for progress indicator, concatenated with the main adapter. val concatAdapter = ConcatAdapter(dataAdapter, progressAdapter) progressAdapter should return 0 or 1 from getItemCount() method, depending on the loading state. More info: [LINK] And check the current stable version of recyclerview library, might be already in a stable version at the time of reading: [LINK] Another viable approach would be to use recycler view item decorations. Using this approach would also save from modifying the ViewHolder

Cites Cilenco · 2022-09 · Stack Overflow · on “Paging data from database and network in Flutter”

I'm pretty new to Flutter development, coming from an Android background. I want to implement the following pattern [this video] like it is commenly used with the Paging 3 jetpack library: UI <-------> Repo --- Out of data ---> Network ^ | | | ---------- Save ------------ I also want to support paging in both directions. Anything I have seen so far on pub.dev is only paging in one direction. Do I have to implement this pattern for myself or is there already a library for this?