How to Implement Pagination With Jetpack Compose - Android Studio Tutorial

Поділитися
Вставка
  • Опубліковано 15 вер 2024

КОМЕНТАРІ • 74

  • @Landofcoding
    @Landofcoding Рік тому +7

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

  • @codinginflow
    @codinginflow 2 роки тому +16

    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

  • @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

  • @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!

  • @arnobk
    @arnobk 2 роки тому +6

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

  • @TomBerghuis
    @TomBerghuis 2 роки тому +21

    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 роки тому +5

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

    • @tomasskarnulis6005
      @tomasskarnulis6005 10 місяців тому +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 6 місяців тому

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

  • @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

  • @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

  • @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 🐕

  • @renzcarlosalanga1970
    @renzcarlosalanga1970 2 роки тому +1

    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?

  • @ndonnayacynth1991
    @ndonnayacynth1991 2 місяці тому +1

    The perfect one

  • @user-xz9iv7st3p
    @user-xz9iv7st3p 9 місяців тому

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

  • @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?

  • @JohanAlbrectsen
    @JohanAlbrectsen Рік тому

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

  • @AlexUjvary
    @AlexUjvary 11 місяців тому

    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 8 місяців тому

      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

  • @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 :)

  • @harishpadmanabh6857
    @harishpadmanabh6857 7 місяців тому

    @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?

  • @liosha2007
    @liosha2007 2 роки тому

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

  • @TiagoDvl
    @TiagoDvl 2 роки тому

    Nice video, man. Well done!

  • @jozefvivodik912
    @jozefvivodik912 2 роки тому

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

  • @rhen4610
    @rhen4610 2 роки тому

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

  • @mustafaammar551
    @mustafaammar551 2 роки тому

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

  • @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.

  • @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?

  • @tmjromao
    @tmjromao 2 роки тому

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

  • @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

  • @nourmorgan6751
    @nourmorgan6751 Рік тому

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

  • @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 :)

  • @farid8902
    @farid8902 2 роки тому

    Quality content thanx brother❤

  • @hpmusicbytes
    @hpmusicbytes Рік тому

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

  • @ntikomathaba2662
    @ntikomathaba2662 Рік тому

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

  • @dpkaalwyn5104
    @dpkaalwyn5104 2 роки тому

    is there any way to do separator in compose paging

  • @gulfappdeveloper2849
    @gulfappdeveloper2849 2 роки тому +5

    Pagination is difficult task

  • @如意周
    @如意周 Рік тому

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

  • @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... 😟

  • @mhdunknown
    @mhdunknown Рік тому

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

  • @sovrinfo
    @sovrinfo 2 роки тому

    Thank you a lot!

  • @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

  • @John-qt6qk
    @John-qt6qk 2 роки тому

    Would be fun see a hide and show FB or Snackbar

  • @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

  • @pierre.vieira
    @pierre.vieira 2 роки тому

    Can you make a video using paging-compose library?

  • @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.

  • @ho-thtmarketingonline711
    @ho-thtmarketingonline711 Рік тому

  • @favour2871
    @favour2871 2 роки тому

    thx

  • @amitmondal7427
    @amitmondal7427 2 роки тому

    But, I used Paging 3.

  • @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

  • @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 😂

  • @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)?