How to Implement Pagination With Jetpack Compose - Android Studio Tutorial

preview_player
Показать описание
Very often, you get some large sets of data from a remote API and you don't want to fetch it all at once. Instead, you want to only load what the user needs to see. That's called pagination.
In this video you'll learn about my approach using Jetpack Compose.

⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:

🎓 Become an industry-ready developer in the Mobile Dev Campus:

🎁 Get my FREE 4.5h course "The Best Practice Guide to Android Architecture":

Read our weekly Android blog:

Join this channel to get access to perks:

Get the source code for this video here:

Join my Discord server:

You like my free content? Here you can buy me a coffee:
Рекомендации по теме
Комментарии
Автор

If you modify the items in that list you get a 2nd source of truth. Generally, all properties in your data class should be vals.

codinginflow
Автор

This video is helpful, not only for paging but it also teaches how to design a solution for a programming struggle.

Landofcoding
Автор

Did try Paging 3 recently and I find it difficult to implement, tough to reflect LoadStates from its RemoteMediator in the data layer. Might just use this one. Big thanks!

edwardjosephpegollo
Автор

Hey Philip can you make a video on multiple navhost I want to say that in main navhost I have 4 composable one of them have another navhost with bottombar and bottom baars tabs have separate navhost I think it's complex navigation but can you make it humble request

topchannels
Автор

Please make a tutorial on implementing Material You with Jetpack Compose.

arnobk
Автор

I think you should only run the side effect viewModel.loadNextItems() within LaunchedEffect not in the composable function. So you would have val scrollState = rememberLazyListState() LaunchedEffect(scrollState){ (condition to check if scrolled to end) { viewModel.loadNextItems() } }

TomBerghuis
Автор

How would this work when returning a Flow<List<T>> from a room dao method?

aloussase
Автор

it is working as charm, thanks Mr Phlipp ✅

ozodbekkarimov
Автор

Maybe i am misunderstanding it, but this seems like a solution for a rare case where the API will send all the data, and the pagination happens locally. In real life usually the API sends just a small part and a pagenumber.

AlexUjvary
Автор

Really thanks for all you do ...your channel has been really helpful in my learning, these contents have been the best that I'd like to ask I'd you could make maybe a video that dives into recyclerview and some of it features too like the multiple header and sticky header...Thank you

LazySadist
Автор

For some reason, I was under the impression that the current views that display lists of data (I'm coming from old Java/XML apps from like Android v6/7 days) did this loading of more items dynamically, already. Well that's a bummer lol. Thankfully my simple crappy app won't have to worry about that much data, but this is good stuff big 🐕

clamum
Автор

Hi Phillip, love the video, saw it a couple times. Could you do a video on the RemoteMediator, that integrates Room?

JohanAlbrectsen
Автор

this is not good you are loading the items on a list. You just keep piling up the List<Item> eventually it will result in an oom. where is page dropping?

renzcarlosalanga
Автор

hi Philipp, can you make a series about the paging 3 library ? Thank you

nourmorgan
Автор

Nice one Philip I've done custom pagination implementations before and they are not so straight forward, nice to see a working compose implementation, could it be easier with flows? Nice one! 🙏

CitizenWarwick
Автор

Hello Philip, could you do video explaining how you would load static JSON content from resources folder? many thanks, regards.

tmjromao
Автор

Thats really awsome . I just wonder how can we include local database like room into it

hpmusicbytes
Автор

hi Philipp, how would you test the viewmodel in this implementation? I wonder if it would be better to implement a Paginator, inject to the viewmodel, and access the methods. Any thoughts if that would be better? Thank you

alicantipi
Автор

Awesome video! Just one question, how do you update an item from a page source?

ntikomathaba
Автор

I had this problem with paging 3, I needed to display some graphics when the list was empty from the api.

The hacky solution I used was to throw a custom exception in the RemoteDataSource and catch that exception in the UI layer.
Of course Document your exceptions in your project ReadMe

efeegbevwie