Paging 라이브러리를 사용하면 로컬 저장소에서나 네트워크를 통해 대규모 데이터 세트의 데이터 페이지를 로드하고 표시할 수 있습니다. 이 방식을 사용하면 앱에서 네트워크 대역폭과 시스템 리소스를 모두 더 효율적으로 사용할 수 있습니다. Paging 라이브러리의 구성요소는 권장 Android 앱 아키텍처에 맞게 설계되었으며 다른 Jetpack 구성요소와 원활하게 통합되고 최고 수준으로 Kotlin을 지원합니다.
페이징 라이브러리를 사용하여 얻을 수 있는 이점
페이징 라이브러리에는 다음과 같은 기능이 있습니다.
Paging된 데이터의 메모리 내 캐싱. 이렇게 하면 앱이 Paging 데이터로 작업하는 동안 시스템 리소스를 효율적으로 사용할 수 있습니다.
요청 중복 삭제 기능이 기본 제공되므로 앱에서 네트워크 대역폭과 시스템 리소스를 효율적으로 사용할 수 있습니다.
사용자가 로드된 데이터의 끝까지 스크롤할 때 구성 가능한 RecyclerView 어댑터가 자동으로 데이터를 요청합니다.
Kotlin 코루틴 및 플로뿐만 아니라 LiveData 및 RxJava를 최고 수준으로 지원합니다.
새로고침 및 재시도 기능을 포함하여 오류 처리를 기본으로 지원합니다.
의견 보내기
제출하신 의견은 Jetpack을 개선하는 데 도움이 됩니다. 새로운 문제를 발견하거나 라이브러리 개선을 위한 아이디어가 있다면 Google에 알려 주세요. 새 문제를 제출하기 전에 이 라이브러리의 기존 문제를 확인하시기 바랍니다. 별표 버튼을 클릭하여 기존 문제에 투표할 수 있습니다.
이 섹션에서는 각 레이어에서 작동하는 페이징 라이브러리 구성요소와 이 구성요소가 함께 작동하여 페이징된 데이터를 로드하고 표시하는 방법을 설명합니다.
저장소 레이어
저장소 레이어의 기본 페이징 라이브러리 구성요소는 PagingSource입니다. 각 PagingSource 객체는 데이터 소스와 이 소스에서 데이터를 검색하는 방법을 정의합니다. PagingSource 객체는 네트워크 소스 및 로컬 데이터베이스를 포함한 단일 소스에서 데이터를 로드할 수 있습니다.
사용할 수 있는 다른 페이징 라이브러리 구성요소는 RemoteMediator입니다. RemoteMediator 객체는 로컬 데이터베이스 캐시가 있는 네트워크 데이터 소스와 같은 계층화된 데이터 소스의 페이징을 처리합니다.
ViewModel 레이어
Pager 구성요소는 PagingSource 객체 및 PagingConfig 구성 객체를 바탕으로 반응형 스트림에 노출되는 PagingData 인스턴스를 구성하기 위한 공개 API를 제공합니다.
ViewModel 레이어를 UI에 연결하는 구성요소는 PagingData입니다. PagingData 객체는 페이지로 나눈 데이터의 스냅샷을 보유하는 컨테이너입니다. PagingSource 객체를 쿼리하여 결과를 저장합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-27(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-27(UTC)"],[],[],null,["Paging library overview\nPart of [Android Jetpack](/jetpack).\n\nThe Paging library helps you load and display pages of data from a larger\ndataset from local storage or over a network. This approach lets your app use\nboth network bandwidth and system resources more efficiently. The components of\nthe Paging library are designed to fit into the recommended [Android app\narchitecture](/jetpack/docs/guide), integrate cleanly with other\n[Jetpack](/jetpack) components, and provide first-class Kotlin support.\n\nBenefits of using the Paging library\n\nThe Paging library includes the following features:\n\n- In-memory caching for your paged data. This helps ensure that your app uses system resources efficiently while working with paged data.\n- Built-in request deduplication, which helps ensure that your app uses network bandwidth and system resources efficiently.\n- Configurable [`RecyclerView`](/reference/kotlin/androidx/recyclerview/widget/RecyclerView) adapters that automatically request data as the user scrolls toward the end of the loaded data.\n- First-class support for Kotlin coroutines and flows as well as [`LiveData`](/reference/kotlin/androidx/lifecycle/LiveData) and RxJava.\n- Built-in support for error handling, including refresh and retry capabilities.\n\nProvide feedback\n\nYour feedback helps make Jetpack better. Let us know if you discover new issues\nor have ideas for improving this library. Check the\n[existing issues](https://issuetracker.google.com/issues?q=componentid:413106%20status:open)\nfor this library before you create a new one. You can add your vote to an\nexisting issue by clicking the star button.\n\n[Create a new issue](https://issuetracker.google.com/issues/new?component=413106&template=1096385)\n\nSee the [Issue Tracker\ndocumentation](https://developers.google.com/issue-tracker) for more\ninformation about submitting feedback.\n\nSetup\n\nTo import Paging components into your Android app, add the following\ndependencies to your app's `build.gradle` file: \n\nGroovy \n\n```groovy\ndependencies {\n def paging_version = \"3.3.6\"\n\n implementation \"androidx.paging:paging-runtime:$paging_version\"\n\n // alternatively - without Android dependencies for tests\n testImplementation \"androidx.paging:paging-common:$paging_version\"\n\n // optional - RxJava2 support\n implementation \"androidx.paging:paging-rxjava2:$paging_version\"\n\n // optional - RxJava3 support\n implementation \"androidx.paging:paging-rxjava3:$paging_version\"\n\n // optional - Guava ListenableFuture support\n implementation \"androidx.paging:paging-guava:$paging_version\"\n\n // optional - Jetpack Compose integration\n implementation \"androidx.paging:paging-compose:3.4.0-alpha03\"\n}\n```\n\nKotlin \n\n```kotlin\ndependencies {\n val paging_version = \"3.3.6\"\n\n implementation(\"androidx.paging:paging-runtime:$paging_version\")\n\n // alternatively - without Android dependencies for tests\n testImplementation(\"androidx.paging:paging-common:$paging_version\")\n\n // optional - RxJava2 support\n implementation(\"androidx.paging:paging-rxjava2:$paging_version\")\n\n // optional - RxJava3 support\n implementation(\"androidx.paging:paging-rxjava3:$paging_version\")\n\n // optional - Guava ListenableFuture support\n implementation(\"androidx.paging:paging-guava:$paging_version\")\n\n // optional - Jetpack Compose integration\n implementation(\"androidx.paging:paging-compose:3.4.0-alpha03\")\n}\n```\n\nLibrary architecture\n\nThe Paging library's components operate in three\nlayers of your app:\n\n- The repository layer\n- The `ViewModel` layer\n- The UI layer\n\n**Figure 1.** An example of how the Paging library fits into your app architecture.\n\nThis section describes the Paging library components that operate at each layer\nand how they work together to load and display paged data.\n\nRepository layer\n\nThe primary Paging library component in the repository layer is\n[`PagingSource`](/reference/kotlin/androidx/paging/PagingSource). Each\n`PagingSource` object defines a source of data and how to retrieve data from\nthat source. A `PagingSource` object can load data from any single source,\nincluding network sources and local databases.\n\nAnother Paging library component that you might use is\n[`RemoteMediator`](/reference/kotlin/androidx/paging/RemoteMediator). A\n`RemoteMediator` object handles paging from a layered data source, such as a\nnetwork data source with a local database cache.\n\nViewModel layer\n\nThe [`Pager`](/reference/kotlin/androidx/paging/Pager) component provides a\npublic API for constructing instances of `PagingData` that are exposed in\nreactive streams, based on a `PagingSource` object and a\n[`PagingConfig`](/reference/kotlin/androidx/paging/PagingConfig) configuration\nobject.\n\nThe component that connects the `ViewModel` layer to the UI is\n[`PagingData`](/reference/kotlin/androidx/paging/PagingData). A `PagingData`\nobject is a container for a snapshot of paginated data. It queries a\n[`PagingSource`](/reference/kotlin/androidx/paging/PagingSource) object and\nstores the result.\n\nUI layer\n\nThe primary Paging library component in the UI layer is\n[`PagingDataAdapter`](/reference/kotlin/androidx/paging/PagingDataAdapter), a\n[`RecyclerView`](/reference/kotlin/androidx/recyclerview/widget/RecyclerView)\nadapter that handles paginated data.\n\nAlternatively, you can use the included\n[`AsyncPagingDataDiffer`](/reference/kotlin/androidx/paging/AsyncPagingDataDiffer)\ncomponent to build your own custom adapter.\n| **Note:** If your app uses [Compose](/jetpack/compose) for its UI, use the [`androidx.paging:paging-compose`](/reference/kotlin/androidx/paging/compose/package-summary) artifact to integrate Paging with your UI layer instead. To learn more, see the API documentation for [`collectAsLazyPagingItems()`](/reference/kotlin/androidx/paging/compose/package-summary#collectaslazypagingitems).\n\nAdditional resources\n\nTo learn more about the Paging library, see the following additional resources:\n\nCodelabs\n\n- [Android Paging Basics codelab](https://developer.android.com/codelabs/android-paging-basics)\n- [Android Paging Advanced codelab](https://codelabs.developers.google.com/codelabs/android-paging)\n\nRecommended for you\n\n- Note: link text is displayed when JavaScript is off\n- [Load and display paged data](/topic/libraries/architecture/paging/v3-paged-data)\n- [Migrate to Paging 3](/topic/libraries/architecture/paging/v3-migration)\n- [Page from network and database](/topic/libraries/architecture/paging/v3-network-db)"]]