How to Implement Pagination With Jetpack Compose - Android Studio Tutorial

Поделиться
HTML-код
  • Опубликовано: 26 ноя 2024

Комментарии • 75

  • @codinginflow
    @codinginflow 2 года назад +17

    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.

    • @JujareVinayak
      @JujareVinayak 2 года назад +2

      I have stopped watching your videos because of Philipp🤣

    • @codinginflow
      @codinginflow 2 года назад +3

      @@JujareVinayak I haven't made any new android tutorials in over a year

    • @JujareVinayak
      @JujareVinayak 2 года назад +2

      @@codinginflow Why why why?? I see only podcasts. We need your videos back. You were my first tutor.

    • @amitmondal7427
      @amitmondal7427 2 года назад +1

      @@codinginflow I think, You should start again.

    • @jaloliddinabdullaev2310
      @jaloliddinabdullaev2310 Год назад

      You should come back! You were good instructor and explain everything in detail, I really love your videos@@codinginflow

  • @Landofcoding
    @Landofcoding 2 года назад +7

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

  • @top10channels31
    @top10channels31 2 года назад +14

    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

  • @arnobk
    @arnobk 2 года назад +6

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

  • @edwardjosephpegollo3411
    @edwardjosephpegollo3411 2 года назад +6

    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!

  • @TomBerghuis
    @TomBerghuis 2 года назад +23

    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() } }

    • @PhilippLackner
      @PhilippLackner  2 года назад +7

      That's a great way to handle this, I didn't think of that. Thanks!

    • @tomasskarnulis6005
      @tomasskarnulis6005 Год назад +1

      1 year after and still find same thought about pagger 3 - it's ridiculously hard to modifie after fetch, you stricten to use "page: Int", not that clear refresh...
      With this little update feels like this would be better custom solution, thanks to you 2 !

  • @aloussase
    @aloussase 8 месяцев назад

    How would this work when returning a Flow from a room dao method?

  • @ozodbekkarimov5573
    @ozodbekkarimov5573 Месяц назад

    it is working as charm, thanks Mr Phlipp ✅

  • @renzcarlosalanga1970
    @renzcarlosalanga1970 2 года назад +2

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

  • @clamum9648
    @clamum9648 2 года назад

    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 🐕

  • @buszi_
    @buszi_ 2 года назад +4

    I feel like this is not really a Composable like approach, the way you fire the next request by calling the ViewModel during the composition is a huge side effect that should not be allowed

    • @PhilippLackner
      @PhilippLackner  2 года назад +3

      I agree, someone here commented a better approach I didn't think of first. With that it's still a superior approach to pagination IMO :)

  • @LazySadist
    @LazySadist 2 года назад

    Really thanks for all you do ...your channel has been really helpful in my learning, these contents have been the best really.....with 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

  • @AlexUjvary
    @AlexUjvary Год назад

    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.

    • @ingressus17
      @ingressus17 11 месяцев назад

      while i only watched only 1 time and I am a novice, my assumption is that the "whole local" data is only as an example, in reality the calls to a remote API with page numbers (limits, offsets etc) are happening in place of the .slice() function

  • @ndonnayacynth1991
    @ndonnayacynth1991 4 месяца назад +1

    The perfect one

  • @JohanAlbrectsen
    @JohanAlbrectsen Год назад

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

  • @TiagoDvl
    @TiagoDvl 2 года назад

    Nice video, man. Well done!

  • @alicantipi4235
    @alicantipi4235 2 года назад +2

    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

  • @nourmorgan6751
    @nourmorgan6751 Год назад

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

  • @mustafaammar551
    @mustafaammar551 2 года назад

    i wait for this video
    thank you bro you are the best👍👍👍

  • @정현우-y5o
    @정현우-y5o Год назад

    I found bug Philipp. When Data is lower than PageSize, Data is not loaded :(

  • @tmjromao
    @tmjromao 2 года назад

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

  • @liosha2007
    @liosha2007 2 года назад

    Thanks a lot. It's exactly what I need 😊

  • @hpmusicbytes
    @hpmusicbytes Год назад

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

  • @rhen4610
    @rhen4610 2 года назад

    may I know where this custom paginator fall in MVVM architecture?

  • @ntikomathaba2662
    @ntikomathaba2662 2 года назад

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

  • @farid8902
    @farid8902 2 года назад

    Quality content thanx brother❤

  • @ricola4310
    @ricola4310 2 года назад

    Hi I do have a question that's has nothing to do with the video but i don't know where to ask it... I put NoActionBar on my themes and when i run my app in an emulated devices no action bar are shown BUT when i install and run the app on my smartphone an action bar is still displaying why so?

  • @athithyaparamesh8251
    @athithyaparamesh8251 2 года назад

    Please make a tutorial on Retrofit POST request. Or at lease please share some recourses. I'm stuck in this thing for days... 😟

  • @jozefvivodik912
    @jozefvivodik912 2 года назад

    Hi Philip, why you use Interface for DefaultPaginator and not only fun ? thx

  • @CitizenWarwick
    @CitizenWarwick 2 года назад

    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! 🙏

    • @lukalukovic5082
      @lukalukovic5082 2 года назад

      Have you managed to get it to work with flows I'm really having trouble with that?

  • @harishpadmanabh6857
    @harishpadmanabh6857 9 месяцев назад

    @phillipplackner How can use this paginator with a search query in an efficient way with debounce and on each like you mentioned in your implement search video?

  • @efeegbevwie9467
    @efeegbevwie9467 2 года назад +1

    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

  • @mhdunknown
    @mhdunknown Год назад

    Not sure if it's just me, but this video doesn't have any audio.

  • @pierre.vieira
    @pierre.vieira 2 года назад

    Can you make a video using paging-compose library?

  • @ho-thtmarketingonline711
    @ho-thtmarketingonline711 2 года назад

  • @如意周
    @如意周 Год назад

    我想知道lazyColumn能不能反向滚动,就像Twitter的Home页面那样,是向下滚动的

  • @sovrinfo
    @sovrinfo 2 года назад

    Thank you a lot!

  • @osisuper98
    @osisuper98 2 года назад

    Is it okay to paginate data from our local database? I don't mean fetching data from an API now, just data already saved to our device.

  • @masti437
    @masti437 2 года назад

    Hi Philipp ... I am a subscriber to a few of your courses on pl-coding .....
    On course completion ... we get the certificate .... now to add that certificate to LinkedIn...
    LinkedIn requires an official LinkedIn page .... without it we cannot add it ...
    The Coding in flow author has it ... similarly can you also create an official page of pl-coding on LinkedIn
    It will help all your subscribers of your course. ...

    • @PhilippLackner
      @PhilippLackner  2 года назад

      I do have a linkedin page, search for Philipp Lackner

    • @masti437
      @masti437 2 года назад

      ​@@PhilippLackner ... Thank you for replying
      That is your personal page .... Official Page will be something like Pl-Coding .... :) ... Please have a look at this request .... You can take example of official page like "Coding in Flow" or "Code with Mosh" and its how courses are linked across linkdin :) Please check once .... B/w I love your teaching

  • @nikolozlatsabidze2196
    @nikolozlatsabidze2196 2 года назад

    Philipp I am interested in one case, so basically I want to return flow value from callback, but I cannot emit value because it's not suspend, so I came across of callbackflow/channelflow idea, I was interested if it is good to use them, because they are experimental, or do u have any better suggestions that I can use? thx!

    • @PhilippLackner
      @PhilippLackner  2 года назад +2

      If you wanna transform a callback to a flow, using a callback flow makes sense :)

  • @gulfappdeveloper2849
    @gulfappdeveloper2849 2 года назад +5

    Pagination is difficult task

  • @John-qt6qk
    @John-qt6qk 2 года назад

    Would be fun see a hide and show FB or Snackbar

  • @dpkaalwyn5104
    @dpkaalwyn5104 2 года назад

    is there any way to do separator in compose paging

  • @damianviltres2202
    @damianviltres2202 2 года назад

    Nice video, Can I paginate with this example from Room Database and Api as well ? Thanks

    • @PhilippLackner
      @PhilippLackner  2 года назад +2

      Sure

    • @damianviltres2202
      @damianviltres2202 2 года назад

      @@PhilippLackner It will be awesome if you make a video run this example with Room Database. I will be thankful grateful. Thank you again

  • @favour2871
    @favour2871 2 года назад

    thx

  • @amitmondal7427
    @amitmondal7427 2 года назад

    But, I used Paging 3.

  • @MetehanBOLAT
    @MetehanBOLAT 2 года назад

    Please make a video about widgets (It doesn't have to be with compose :D ) There is very little content on this topic. It's hard to understand.

  • @nipunkumarit2168
    @nipunkumarit2168 2 года назад

    You already have a pagination video in pokedex app, why you upload same thing again??

    • @PhilippLackner
      @PhilippLackner  2 года назад +18

      You already watched the pokedex video, why you watch this again?

    • @nipunkumarit2168
      @nipunkumarit2168 2 года назад +1

      @@PhilippLackner nice punch 😂

  • @harisai3580
    @harisai3580 2 года назад

    What is pagination? Please explain briefly why we need this

    • @adrian110288
      @adrian110288 2 года назад +4

      When you for example have a list of 100 items, but you only load first 20 and when you scroll the list to the bottom, you load the next 20

  • @XDgamer1
    @XDgamer1 2 года назад

    Recycler View is faster

    • @clamum9648
      @clamum9648 2 года назад

      Does that take care of this dynamic list item loading? I was under the impression that the newer Android controls already did this (my app is super old and I'm rewriting it in Jetpack/Kotlin) but I'm pretty much a n00b so I could be wrong. Does that mean that for Jetpack you need to handle it yourself, like he's doing here (or use library)?