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

  Рет қаралды 9,870

Philipp Lackner

Philipp Lackner

Күн бұрын

In this video you'll learn how you can pass any type of data class as an argument from one screen to another using the new type-safe navigation framework.
💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:
pl-coding.com/...
⭐ Courses with real-life practices
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:
pl-coding.com/...
Get my FREE PDF about 20 things you should never do in Jetpack Compose:
pl-coding.com/...
Regular programming advice on my Instagram page: / _philipplackner_
Join my Discord server:
/ discord
Get the source code for this video on GitHub:
github.com/phi...

Пікірлер: 52
@Razo.TR0N
@Razo.TR0N Ай бұрын
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.
@PhilippLackner
@PhilippLackner Ай бұрын
🙏❤️
@cfa532
@cfa532 28 күн бұрын
The 2-weeks-old video is just in-time to solve my problem. Thanks a lot.
@ren7907
@ren7907 Ай бұрын
thanks for this video Philipp. Got a quick question. How could I extract the dog model from the savedStateHandle on the details screen viewmodel?
@h4ktbtw
@h4ktbtw Ай бұрын
Too bad they did not utilize the serialization fully. Registering custom NavTypes for serializable classess is such a bad design decision.
@cristian1234584
@cristian1234584 Ай бұрын
Great! Philipp, do you have any video showing your Android Studio IDE configurations?
@michaelndiritu6413
@michaelndiritu6413 Ай бұрын
the latest navigation release doesn't require the typeMap of enum to be passed.
@skyles146
@skyles146 Ай бұрын
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.
@stevenrathmann7823
@stevenrathmann7823 9 күн бұрын
Could you please explain how i can pass an argument from DogDetail back to DogList if the DogDetail Screen is finish?
@raulprior9635
@raulprior9635 Ай бұрын
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
@kabindrashrestha3760
@kabindrashrestha3760 10 күн бұрын
Hi @Philipp, How to pass Custom NavTypes in Compose MultiPlatform for Type-Safe Navigation on Android and IOS?
@Tbijo54
@Tbijo54 Ай бұрын
Awesome video, thanks Philipp. Could you also make one explaining how to pass type safe arguments to a nested navigation?
@PhilippLackner
@PhilippLackner Ай бұрын
@@Tbijo54 that's should be no different :)
@skyles146
@skyles146 Ай бұрын
The only thing you need to know for nested destination is that a startDestination can't have argument. That's all.
@raghavaggarwal8644
@raghavaggarwal8644 Ай бұрын
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 Ай бұрын
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 Ай бұрын
I see, need to read the docs about the Bundle limit. Thanks
@slyene6202
@slyene6202 15 күн бұрын
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
@RABBITV
@RABBITV 14 күн бұрын
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 3 күн бұрын
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.
@nott__aceu4857
@nott__aceu4857 Ай бұрын
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 ?
@prathivar6721
@prathivar6721 Ай бұрын
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 ;;;;;)
@flowzk921
@flowzk921 Ай бұрын
Awesome One!
@mikelantzelo
@mikelantzelo Ай бұрын
Why my android studio does not recommend autocomplete like yours ? Thanks for excellent content !!!
@trungnguyenhuu8184
@trungnguyenhuu8184 Ай бұрын
You can turn on AI completion
@mikelantzelo
@mikelantzelo Ай бұрын
@@trungnguyenhuu8184 thank you
@animefind5264
@animefind5264 Ай бұрын
How navigate inside bottom navigation menu with type-safe
@tweeel38
@tweeel38 Ай бұрын
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 Ай бұрын
But voyager available :)
@osisuper98
@osisuper98 Ай бұрын
Type safe navigation is already available in the last release
@tweeel38
@tweeel38 Ай бұрын
@@osisuper98 yes but from what I've tried, it still not available in kmp
@jackeblan
@jackeblan Ай бұрын
KMP is full of hacks and 3rd party libraries written by a guy from Finland. Not yet.
@Jaykumar-t9m
@Jaykumar-t9m Ай бұрын
Can you make tutorial for Image Picking , I am currently facing issues , like Parcelable , i am using Ktor , koin , and voyager and I am facing issue for Image picking in KMP
@ArthurKhazbs
@ArthurKhazbs Ай бұрын
why `val DogType = object` and not just `object DogType`?
@L4szcZ
@L4szcZ Ай бұрын
Why we are using @Serializable and not @Parcelize?
@marksunghunpark
@marksunghunpark Ай бұрын
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 Ай бұрын
I agree
@trungnguyenhuu8184
@trungnguyenhuu8184 Ай бұрын
It's kotlin serialization, not Java serializable
@aihamhammad3074
@aihamhammad3074 Ай бұрын
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 Ай бұрын
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.
@Bandy_K7
@Bandy_K7 Ай бұрын
thanks for this video. if you can make a video on android auto and automotive os it would be great.
@surjithkumar8177
@surjithkumar8177 Ай бұрын
Is this custom nav supports to add a screen transition?
@umidolimzhanov6078
@umidolimzhanov6078 Ай бұрын
Great video! Can I use it somehow to return result from screen?
@mudPuddlePanda
@mudPuddlePanda Ай бұрын
Nice
@Abhigyan103
@Abhigyan103 Ай бұрын
How to pass view models between screens using this ? Please help
@malding1
@malding1 Ай бұрын
Why would you want to pass viewmodels?
@Abhigyan103
@Abhigyan103 Ай бұрын
@@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 Ай бұрын
@@Abhigyan103 he has another video how to pass share view models between screens its very good
derivedStateOf VS. remember(key) - THIS is Really the Difference 🤯
14:46
MVVM vs. MVI - Understand the Difference Once and for All
18:40
Philipp Lackner
Рет қаралды 43 М.
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 9 МЛН
OYUNCAK MİKROFON İLE TRAFİK LAMBASINI DEĞİŞTİRDİ 😱
00:17
Melih Taşçı
Рет қаралды 12 МЛН
HAH Chaos in the Bathroom 🚽✨ Smart Tools for the Throne 😜
00:49
123 GO! Kevin
Рет қаралды 15 МЛН
Остановили аттракцион из-за дочки!
00:42
Victoria Portfolio
Рет қаралды 3,7 МЛН
Navigation Compose meet Type Safety
16:50
Android Developers
Рет қаралды 11 М.
Nothing is really cool in Kotlin
7:43
Sebastian Sellmair
Рет қаралды 6 М.
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 120 М.
NSURLProtocol: How I Stole an App For My Wedding
56:25
Bryce Bostwick
Рет қаралды 36 М.
Type-Safe Navigation with the OFFICIAL Compose Navigation Library
10:03
Solving distributed systems challenges in Rust
3:15:52
Jon Gjengset
Рет қаралды 241 М.
I built 10 web apps... with 10 different languages
14:23
Fireship
Рет қаралды 1,6 МЛН
Spongebob ate Michael Jackson 😱 #meme #spongebob #gmod
00:14
Mr. LoLo
Рет қаралды 9 МЛН