Android Paging
source link: https://developer.android.com/codelabs/android-paging#0
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
About this codelab
1. Introduction
What you'll learn
- What the main components of Paging 3.0 are.
- How to add Paging 3.0 to your project.
- How to add a header or footer to your list using the Paging 3.0 API.
- How to add list separators using the Paging 3.0 API.
- How to page from network and database
What you'll build
In this codelab, you start with a sample app that already displays a list of GitHub repositories. Whenever the user scrolls to the end of the displayed list, a new network request is triggered and its result is displayed on the screen.
You will add code through a series of steps, to achieve the following:
- Migrate to the Paging library components.
- Add a loading status header and footer to your list.
- Show loading progress between every new repository search.
- Add separators in your list.
- Add database support for paging from network and database
Here's what your app will look like in the end:
What you'll need
- Android Studio 3.6 or higher.
- Familiarity with the following Architecture Components: LiveData, ViewModel, View Binding and with the architecture suggested in the " Guide to App Architecture".
- Familiarity with coroutines and Kotlin Flow.
For an introduction to Architecture Components, check out the Room with a View codelab. For an introduction to Flow, check out the Advanced Coroutines with Kotlin Flow and LiveData codelab.
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK