This repository demonstrates how to implement efficient pagination with image loading in an Android app using Paging 3, Kotlin, and Jetpack Compose.
- Pagination with Paging3: Seamlessly load data page by page as the user scrolls.
- Jetpack Compose UI: Modern, declarative UI with Compose.
- Image Loading: Efficient and smooth image loading for paged items.
- Kotlin: Entire project written in idiomatic Kotlin.
2025-06-17.12.22.21.mp4
- Android Studio (Chipmunk or newer recommended)
- Minimum SDK 21+
- Kotlin 1.7 or newer
- Clone the repository:
git clone https://github.com/zahid-git/Paging3-Image-Loading.git
- Open in Android Studio:
- Select
Open an existing Android Studio project
and navigate to the cloned folder.
- Select
- Build and Run:
- Click the 'Run' button or use
Shift+F10
to build and launch the app on your device or emulator.
- Click the 'Run' button or use
- Paging 3
- Jetpack Compose
- Coil or your preferred image loader
- Kotlin Coroutines
The app fetches a list of images (e.g., from a mock API), displays them in a vertical list, and automatically loads more as you scroll.
val pager = Pager(
config = PagingConfig(pageSize = 20),
pagingSourceFactory = { ImagePagingSource(api) }
).flow.cachedIn(viewModelScope)