How to Pass Custom NavTypes in Compose Type-Safe Navigation - Android Studio Tutorial

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

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

  • @Razo.TR0N
    @Razo.TR0N 3 месяца назад +12

    Yesterday was exactly two years of my sponsorship of your channel! Thank you Philipp for your videos and especially for the videos from Twitch, which two years ago opened the door to the world of development for me. Developing a full-fledged social network app on Compose with a multi-module clean architecture in combination with a KTOR backend and its deployment to the server is the best thing education material I have ever seen in my life.

  • @NikNewNik
    @NikNewNik 13 дней назад +2

    THANK YOU PHILIPP !!! It works !😃👍

  • @cfa532
    @cfa532 2 месяца назад

    The 2-weeks-old video is just in-time to solve my problem. Thanks a lot.

  • @cristian1234584
    @cristian1234584 3 месяца назад +1

    Great! Philipp, do you have any video showing your Android Studio IDE configurations?

  • @renvzla
    @renvzla 3 месяца назад +3

    thanks for this video Philipp.
    Got a quick question. How could I extract the dog model from the savedStateHandle on the details screen viewmodel?

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

      savedStateHandle.toRoute() ?

  • @h4ktbtw
    @h4ktbtw 3 месяца назад +7

    Too bad they did not utilize the serialization fully. Registering custom NavTypes for serializable classess is such a bad design decision.

  • @umidolimzhanov6078
    @umidolimzhanov6078 3 месяца назад

    Great video! Can I use it somehow to return result from screen?

  • @raulprior9635
    @raulprior9635 3 месяца назад

    Hi Phillip can you show us how to build an interface for handle navigation actions with the navController in view models, but you know in a way that View Models still being testable, love you videos thanks so mucho

  • @sakibsyed7626
    @sakibsyed7626 3 дня назад

    Great and life saver ❤

  • @Bandy_K7
    @Bandy_K7 3 месяца назад

    thanks for this video.
    if you can make a video on android auto and automotive os it would be great.

  • @Tbijo54
    @Tbijo54 3 месяца назад

    Awesome video, thanks Philipp. Could you also make one explaining how to pass type safe arguments to a nested navigation?

    • @PhilippLackner
      @PhilippLackner  3 месяца назад

      @@Tbijo54 that's should be no different :)

    • @skyles146
      @skyles146 3 месяца назад

      The only thing you need to know for nested destination is that a startDestination can't have argument. That's all.

  • @raghavaggarwal8644
    @raghavaggarwal8644 3 месяца назад +1

    Hi Philipp, you mentioned that one should not use this approach in case of big custom objects because the Bundle has some limits but I wonder why anyone has never highlighted the same before? Like people have been and still use Bundles for passing arguments to Fragments when they create a Fragment's instance. We are using the same Bundle class here too right?

    • @PhilippLackner
      @PhilippLackner  3 месяца назад +1

      This has been highlighted lots of times that it's better to pass an ID and reload something from the DB rather than passing the whole object. The official docs also suggest that somewhere

    • @raghavaggarwal8644
      @raghavaggarwal8644 3 месяца назад +1

      I see, need to read the docs about the Bundle limit. Thanks

  • @ndiritumichael
    @ndiritumichael 3 месяца назад +5

    the latest navigation release doesn't require the typeMap of enum to be passed.

    • @skyles146
      @skyles146 3 месяца назад +1

      It is required on beta07 on minified app or it will crash. There is an issue tracker on this and it will be solved in the next version 21st of August.

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

    i know this is 1 month old...
    but is this still up to date witht the 2.8.1 compose navigation ? (the stable one) or is there an easiest way to do this?

  • @stevenrathmann7823
    @stevenrathmann7823 2 месяца назад

    Could you please explain how i can pass an argument from DogDetail back to DogList if the DogDetail Screen is finish?

  • @RABBITV
    @RABBITV 2 месяца назад

    Hi Philipp , rly thank you for this video , thx to you my routing start working . L have one question to you , why you in this code in NavType use Uri.decode and encode ? Why is is important to do it ? Again thx fro the video :)

    • @muhammadnaveeed9382
      @muhammadnaveeed9382 2 месяца назад +2

      If we don't use the URI then app will crash if we have some special characters like "?", "/" in params of Custom Type like for image of User can have these, so we need to encode & decode that to string.

  • @prathivar6721
    @prathivar6721 2 месяца назад

    Nice explanation ;)
    but
    on the first hand why does kotlin wt's to do serialisation on navigation , why can't it pass as normal parameter to constructor . fine ;;;;;)

  • @nott__aceu4857
    @nott__aceu4857 3 месяца назад

    I would rather save the data in a ViewModel than pass it as an argument (if its large data), What is your take on this ?

  • @MattCM89
    @MattCM89 7 дней назад

    How do we do this for hilt-navigation? don't they conflict?

  • @mikelantzelo
    @mikelantzelo 3 месяца назад

    Why my android studio does not recommend autocomplete like yours ? Thanks for excellent content !!!

  • @kabindrashrestha3760
    @kabindrashrestha3760 2 месяца назад

    Hi @PhilippLackner , How to pass Custom NavTypes in Compose MultiPlatform for Type-Safe Navigation on Android and IOS?

  • @surjithkumar8177
    @surjithkumar8177 3 месяца назад

    Is this custom nav supports to add a screen transition?

  • @flowzk921
    @flowzk921 3 месяца назад

    Awesome One!

  • @animefind5264
    @animefind5264 3 месяца назад

    How navigate inside bottom navigation menu with type-safe

  • @slyene6202
    @slyene6202 2 месяца назад

    Could you please clarify how to create nullable custom types? Because I get an error "Cannot cast ... to NavType. Make sure to provide...". I set nullable in all places where it should be and set isNullableAllowed to true, bui it doesn't work

  • @tweeel38
    @tweeel38 3 месяца назад

    Just to confirm, I don't think that feature is available for Compose Multiplatform and nor the type safe navigation, for now at least
    ?

    • @ahmedaaoua
      @ahmedaaoua 3 месяца назад +1

      But voyager available :)

    • @osisuper98
      @osisuper98 3 месяца назад

      Type safe navigation is already available in the last release

    • @tweeel38
      @tweeel38 3 месяца назад

      @@osisuper98 yes but from what I've tried, it still not available in kmp

    • @jackeblan
      @jackeblan 3 месяца назад

      KMP is full of hacks and 3rd party libraries written by a guy from Finland. Not yet.

  • @mudPuddlePanda
    @mudPuddlePanda 3 месяца назад

    Nice

  • @ArthurKhazbs
    @ArthurKhazbs 3 месяца назад

    why `val DogType = object` and not just `object DogType`?

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

  • @Abhigyan103
    @Abhigyan103 3 месяца назад

    How to pass view models between screens using this ? Please help

    • @malding1
      @malding1 3 месяца назад

      Why would you want to pass viewmodels?

    • @Abhigyan103
      @Abhigyan103 3 месяца назад

      @@malding1 if I have 3 screens, one start screen, one with show details, one with edit details, how can I edit details without passing the view model ?
      I recently started learning android, this may be basic

    • @manticomar1146
      @manticomar1146 3 месяца назад +1

      @@Abhigyan103 he has another video how to pass share view models between screens its very good

  • @L4szcZ
    @L4szcZ 3 месяца назад

    Why we are using @Serializable and not @Parcelize?

    • @marksunghunpark
      @marksunghunpark 3 месяца назад +1

      It's Kotlin serialization, not Android thing and it's also multi platform supported. I guess they have the support in their mind.

    • @aj3413
      @aj3413 3 месяца назад

      I agree

    • @trungnguyenhuu8184
      @trungnguyenhuu8184 3 месяца назад

      It's kotlin serialization, not Java serializable

  • @aihamhammad3074
    @aihamhammad3074 3 месяца назад

    DO NOT USE IT
    I used compose type safe navigation in my production app, alot of crashes that are not rereducable poped up in the compose code so I was'nt able to use try and catch,crash free users and sessions droped, navigation 2.8.0 is not a stable version if u want to use some type safe navigation just convert your object to json and send it.

    • @aj3413
      @aj3413 3 месяца назад

      Yup, plus 2.8 probably doesn't support parcelize. A lot of work needs to be done on it. That is the probable reason this version has a lot of beta releases.

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

    What a mess