Questions tagged [android-paging-3]

The Paging library helps you load and display pages of data from a larger dataset from local storage or over network.The latest stable release is Paging 3.0.1

324 questions
5
votes
2 answers

Updating Paging 3 alpha to stable cause indexing issue Android

Hey I am using Paging 3 library with ViewPager 2. In which it loads unlimited data. implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha07" DataSource.kt package com.example.viewpagerexample import java.util.* class DataSource( …
5
votes
1 answer

Android Paging 3 with Room

I'm migrating from Paging 2 to Paging 3. The app stores a large dataset in a database using Room, and I can load the data from Room and display it okay. The issue I have is as soon as the app makes a change to the database, it crashes. Code…
Charlie Wu
  • 7,657
  • 5
  • 33
  • 40
5
votes
2 answers

How to use Android androidx.paging.PagingDataAdapter loadStateFlow to show Empty, Loading and Loaded UI states

My current android application uses Room Paging3 library implementation 'androidx.paging:paging-runtime-ktx:3.0.0-beta01' My requirements are to display either a "Data Loading Spinner", an Empty message when no data is available, or the loaded…
Hector
  • 4,016
  • 21
  • 112
  • 211
5
votes
3 answers

How to Unit Test a Room Dao Query that Returns a PagingSource From Paging 3

My question is actually quite generic. I want to know how to unit test a Room Dao query that returns a PagingSource From Paging 3. I have a Room Dao query: @Query("SELECT * FROM database") fun getChocolateListData(): PagingSource
5
votes
1 answer

Android Room Paging3 correct approach for dynamic filtering

I am investigating the new Android Room Paging library implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha09" My source database tables approx 10,000 rows and I filter by the first character of the name field as…
Hector
  • 4,016
  • 21
  • 112
  • 211
5
votes
1 answer

Paging 3: How to load list at item position or at item with specific id

I have a list of messages. Each message has a unique GUID. My setup is working for normal usage: user clicks on conversation, list opens with all the messages belonging to that conversation, ordered by most recent first. ConversationFragment …
Shadow
  • 4,168
  • 5
  • 41
  • 72
4
votes
2 answers

Adding header to RecyclerView Paging 3 according to a condition from API response

I have implemented Pager 3 for my RecyclerView. Now I have to add a header to my recycler view if the API response has a flag set. What I am doing now is when i get the response, I set this flag to a static variable then in the ViewModel check for…
hushed_voice
  • 3,161
  • 3
  • 34
  • 66
4
votes
0 answers

How to use Paging 3 library with RxJava 3 on Jetpack Compose

At Jetpack Compose documentation, it says that use collectAsLazyPagingItems() to get LazyPagingItems, and pass to LazyColumn's items. The problem is; collectAsLazyPagingItems() function only works in Kotlin Flows, and it seems to only way to create…
4
votes
1 answer

Paging 3 - list scrolls to the beginning after database is updated multiple times

I'm using Paging 3 with RemoteMediator and Room to display a list of items in a RecyclerView with PagingDataAdapter. We have an issue that causes the list to jump to the beginning when underlying data saved in the database is updated multiple…
4
votes
1 answer

Why should AsyncPagingDataDiffer submitData() freeze and timeout the test?

I'm trying to follow this documentation here concerning how to unit test a PagingData stream on which you're applying transforms. The code I am using is similar: @ExperimentalCoroutinesApi @Test fun testGetFooBarsPaged(): Unit = runTest { val…
4
votes
0 answers

How to manually trigger Paging3 to load more data?

Is the Paging library intended to only be used in a list? My use case is continually display more items(markers) on a map. Since I am not using a recyclver view, I don't have a PagingDataAdapter. I believe it is this PagingDataAdapter listening to…
BabyishTank
  • 1,329
  • 3
  • 18
  • 39
4
votes
4 answers

How to save paging state of LazyColumn during navigation in Jetpack Compose

I'm using androidx.paging:paging-compose (v1.0.0-alpha-14), together with Jetpack Compose (v1.0.3), I have a custom PagingSource which is responsible for pulling items from backend. I also use compose navigation component. The problem is I don't…
4
votes
2 answers

How to handle Kotlin Jetpack Paging 3 exceptions?

I am new to kotlin and jetpack, I am requested to handle errors (exceptions) coming from the PagingData, I am not allowed to use Flow, I am only allowed to use LiveData. This is the Repository: class GitRepoRepository(private val service:…
4
votes
0 answers

Paging Library 3 problem when implement search with Room database

I'm trying to implement a search query with Paging 3 Library. I can not find any example so currently, it looking like below. The problem is after the search query result show 2 items, but after I'm clear the filter query, first it rendered the…
4
votes
2 answers

Unit testing a repository with paging 3 using a a remote mediator and paging source

I am trying to unit test a repository class in android which is using paging with a remote mediator and paging source. But when I run the test the returned result is empty, although actual should contain the test item. Like below : Here is my…
Mo Adel
  • 1,136
  • 1
  • 16
  • 29
1 2
3
21 22