Type-Safe Navigation with the OFFICIAL Compose Navigation Library

  Рет қаралды 59,706

Philipp Lackner

Philipp Lackner

Күн бұрын

In this video I'll show you the Type-Safe Navigation with the OFFICIAL Compose Navigation Library!
💻 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...

Пікірлер: 256
@sosaucemp3
@sosaucemp3 4 ай бұрын
7:17 He sounds so happy about it 😭
@WakeupDev.
@WakeupDev. 4 ай бұрын
yea... I felt that in his voice 😄
@farfar5828
@farfar5828 4 ай бұрын
😂😂 I felt that too
@KevinMeneses
@KevinMeneses 4 ай бұрын
X3
@BSS_00
@BSS_00 4 ай бұрын
its like every developer after a new good feature
@ilyastoletov
@ilyastoletov 4 ай бұрын
Cause this feature reduces hundreds of lines of boilerplate parsing arguments, ensuring they're not null, etc...
@Shengdanya
@Shengdanya 4 ай бұрын
Yes. Yes. Yes. Omg. Tears of joy. Really needed a new way!!!!!
@ayitinya
@ayitinya 4 ай бұрын
This is actually the best news in android i've heard in a really long while
@annaberkovitch85
@annaberkovitch85 4 ай бұрын
Philipp, I've no words!!!! Thank you for brightening my day! But mostly thank you for the truly TREMENDOUS amount of work you're doing to bring all those updates to us in a manner that's both timely and incredibly clear. Just... Thank you!!!!
@PhilippLackner
@PhilippLackner 4 ай бұрын
🙌❤️
@nanonkay5669
@nanonkay5669 3 ай бұрын
2 reasons why I started and stopped Android dev within a year: 1. Lack of a package manager that handles all package installations, they're dependencies and versions without having to manually do it every time and manually tweaking package and dependency versions 2. Navigation between screens The second one seems to be solved. If the first one gets solved, I'd be back to Android dev in a heartbeat
@rishabhsaraswat1928
@rishabhsaraswat1928 4 ай бұрын
4:03 we can clearly see his happiness.
@JackCheungShingKit
@JackCheungShingKit 4 ай бұрын
That JSON serialization is how I did before for passing argument. Though my approach on serialization & deserialization boilerplate can be ugly. Agree that it is a great improvement. I wish they made this available since the beginning.
@Jessewb786
@Jessewb786 4 ай бұрын
I was using Circuit and it's own navigation, so I've been making use of type-safe screens with painless parcelable arguments for quite a while. It's nice to now see this present in the official library.
@MatthewSmith-mt3kz
@MatthewSmith-mt3kz 4 ай бұрын
The demo is a pretty simplistic, but a good intro into the new Nav feature. In the real world you'd be getting the screen argument from savedstatehandle. Keep up the good work Phillipp, your videos have saved me hours. Thank you.
@magedahmed5981
@magedahmed5981 4 ай бұрын
Finally .. a simple straight routing .. 😊
@amit470
@amit470 4 ай бұрын
Such a relief, I need this to be in compose stable
@moheltanani1036
@moheltanani1036 3 ай бұрын
If you were in tears, I'm crying right now hehe. Love it, thanks a lot!
@raeesmohit01
@raeesmohit01 4 ай бұрын
It was really a big problem for beginners for me to change the screen and you made it easy now
@geanbrandao4987
@geanbrandao4987 4 ай бұрын
It's so easy now. Thank you for bringing this content to us! Keep up the great work, hugs from Brazil.
@coalacorey
@coalacorey 4 ай бұрын
Finally! As soon as the stable release is out I will implement it.
@yahussainmazloom1
@yahussainmazloom1 4 ай бұрын
Finally some good updates, finally so much relief after this update
@vengateshm2122
@vengateshm2122 4 ай бұрын
There was a crash when we try to pass custom type like User(val id: Int, val name:String, val isPremium) in 2.8.0-alpha08 version which is fixed recently in version 2.8.0-beta01.
@ASTAppLab
@ASTAppLab 4 ай бұрын
being as Android Native Developer appreciate 👍 you
@siftoshka
@siftoshka 4 ай бұрын
What if I need this parameters on ViewModel?
@9Blurke9
@9Blurke9 4 ай бұрын
Now we need another navigation video to compare all the options with pros and cons for each 😄
@TheRobertJamison
@TheRobertJamison 2 ай бұрын
Even more relevant as of July 3rd, since JetBrains released version 2.8.0-alpha08 of their KMP compatible version of navigation-compose.
@quangthaita6084
@quangthaita6084 4 ай бұрын
Thanks who created this, thanks Phillips ❤ That's what we're waiting for
@normno
@normno 4 ай бұрын
Так забавно наблюдать, как мои любимые yoytebers выпускают обзоры на новые функции библиотек android и kmp примерно в одно и тоже время и у каждого свое красивое решение использования.
@MateuszKowol-nu8lr
@MateuszKowol-nu8lr 4 ай бұрын
Still nice improvement however the main advantage of f.e. voyager is that you do not need to declare the navHost and its all routes. Voyager allows you to just jump from ScreenA to ScreenB without declaring it in your navHost. Google's navigation is still kinda similar to the fragment navgraph but without the childlish arrowing thing.
@douglascf2
@douglascf2 4 ай бұрын
Thanks for the video! So exciting! I have a question, does it automatically work with SavedStateHandle in a ViewModel?
@jeonie9682
@jeonie9682 4 ай бұрын
I did today and worked well. but you should use the method now like "SavedStateHandle.toRoute" not just "savedStateHandle" in a ViewModel.
@okeziokezino
@okeziokezino 4 ай бұрын
Philip my guy, this is awesome... love all your work
@paulklein649
@paulklein649 4 ай бұрын
do somebody still wish to work for google and develop shitty frameworks and libs and maybe correct them 2 years later to be somewhat usable? I have the feeling that every dev-product google provides is garbage if jetbrains is not involved in the development
@BigCarso
@BigCarso 2 ай бұрын
What about Compose? Probably the best UI framework in existence
@paulklein649
@paulklein649 2 ай бұрын
@@BigCarso yeah. You mean jetbrains compose just relabeled for android
@BigCarso
@BigCarso Ай бұрын
@@paulklein649 ok you have no idea what you're talking about. Compose was developed by Google team, not Jetbrains
@stijndcl
@stijndcl Ай бұрын
​@@paulklein649 ? JetBrains made compose multiplatform years after the android version, and most of it is a 1:1 port of jetpack compose. Not sure what you're on about with that.
@MO1NKHAN
@MO1NKHAN 4 ай бұрын
OMG, I wish this could have come earlier. In my first app I have spent so much time and effort just to handle navigation without relying on 3rd party libraries. I have an e-commerce app running in production with lots of screens hanging on those route strings. It's time to refactor and remove all that boilerplate code.
@joatancarlos2704
@joatancarlos2704 4 ай бұрын
Thank you for bringing this content in a very didactic way
@filipmanevski9872
@filipmanevski9872 4 ай бұрын
Can you make a video on how to implement this way of navigation, using a navigation drawer for example or a bottom nav bar?
@manticomar1146
@manticomar1146 4 ай бұрын
The questino is in my view model how would I use savedStateHandle to extract the parameters?
@kfirossmatityahu4295
@kfirossmatityahu4295 3 ай бұрын
So actually they got the motivation from Voyager!? (pushing classes as "screens") great!
@aiyuayaan
@aiyuayaan 4 ай бұрын
Thanks @Philipp Lackner, one thing I have to mention is we can't send empty string as value, I am using 2.8.0-beta01.
@SunAndMoon-zc9vd
@SunAndMoon-zc9vd 4 ай бұрын
With "empty string" do you mean: 1.a text with no characters; like "" 2. or do you mean undefined 3. or do you mean null
@aiyuayaan
@aiyuayaan 4 ай бұрын
@@SunAndMoon-zc9vd I mean "" this
@MultiDeivas
@MultiDeivas 3 ай бұрын
It seems like the NavHost causes memory leaks on configuration changes, lovely :)
@youNeverThoughtAboutIt
@youNeverThoughtAboutIt 3 ай бұрын
Shouldn't we store those composables for different screens in separate files? Maybe I'm just thinking in old Fragment style though
@MonichGPT
@MonichGPT 4 ай бұрын
Where is type-safe bottom sheet navigation? I don't see it in the docs. So for now we can't use type-safe navigation at all?
@AKnght
@AKnght 2 ай бұрын
Is this out for Compose Multiplatform yet? Great video!
@darknjko
@darknjko 4 ай бұрын
Thanks again for that demo. Spot on, as always 👍 Originaly, it seemed that the routing library was made to handle all routes as deeplinks. I wonder how deeplinks will work with that new approach? Should we write a deeplink handler that would reroute the user to the proper screen? 🤔
@yanneckreiss
@yanneckreiss 4 ай бұрын
Haha I can relate to your joy about this update so much 😂Great video!
@oneclickmobiledevelopers7825
@oneclickmobiledevelopers7825 3 ай бұрын
Which theme you are using in the android studio, It's awsome..!
@LEEJIHUN
@LEEJIHUN 4 ай бұрын
I was wondering how to migrate the code when using it with BottomNavigation or NestedNavigation
@diabetesatuniversity
@diabetesatuniversity 4 ай бұрын
Thanks this is helpful. Love your videos.
@samuelwakoli
@samuelwakoli 4 ай бұрын
Is Kotlin Multi-Platform industry ready? Can I migrate my Flutter project to KMP?
@loklok2003
@loklok2003 3 ай бұрын
But how can I check the currentDestination using Type-Safe Navigation? For example, I would like to check the selected item in the BottomNavigation which was previously done using a string. However, with Type-Safe Navigation, I'm unable to cast NavDestination to a Serializable object.
@upbeatsarcastic8217
@upbeatsarcastic8217 4 ай бұрын
This is most exciting Compose feature to date imo. Having just finished a Compose app, navigation was the ugliest thing to deal with by a long way.
@MrMacromicro
@MrMacromicro 4 ай бұрын
Thanks philip ,you are really amazing.
@ordnavile
@ordnavile 4 ай бұрын
Very good, my project is in its final stages. I'm going to take advantage and refactor it to be cleaner. Thank you very much friend.
@kurtispalu
@kurtispalu 3 ай бұрын
How do I reference the object into a navigation drawer argument? I keep getting crashes when I try to use a var to carry the object name into the navigation drawer item. Thanks
@rahathossainhimel7177
@rahathossainhimel7177 4 ай бұрын
Finally. Thank you Philipp
@PratikSahu18
@PratikSahu18 4 ай бұрын
Will the object be injected to viewmodel like it used to inject with the parameters when using hilt?
@BorisJakubov
@BorisJakubov 4 ай бұрын
private val ScreenA = savedStateHandle.toRoute()
@BugraKaraahmetoglu
@BugraKaraahmetoglu 4 ай бұрын
Could you please explain how we can safely integrate vertex AI into the application with Google Cloud Console. I need this urgently.
@wilkq1110
@wilkq1110 Ай бұрын
hi Philipp, is nice video, Could you please tell us if this new approach to navigation works well as well with bottom bar navigation ?
@krasavec7088
@krasavec7088 Ай бұрын
Is it possible to use that with nested graphs?
@Pulkit__7
@Pulkit__7 4 ай бұрын
KotlinX Serialization brings back old memories from 2019
@portusdelphini
@portusdelphini 3 ай бұрын
In a prospect of front end routing this looks like a hell. Still a question why it's so complicated?
@arthurabreu1904
@arthurabreu1904 4 ай бұрын
Aaaaand thanks again for sharing man! 🎉🎉🎉
@WakeupDev.
@WakeupDev. 4 ай бұрын
Lucky me.. I just started doing compose and KMP, so I haven't suffered like you 😄 I see some cool changes
@JamesShisiah
@JamesShisiah 2 ай бұрын
Haha, me too.
@radheshyampatel5578
@radheshyampatel5578 4 ай бұрын
I am Big fan of yours video 🎉
@ronalkspdev
@ronalkspdev Ай бұрын
hay un error en el OnRestart cuando la activity se pausa por poca ram y se ejecuta el onRestar manda error de restoring back stack alguien le paso?
@siddharthshakya09
@siddharthshakya09 2 ай бұрын
I have deployed 2 production apps which are used by Big Enterprises. I have used voyager and it's seamless till now. Is it worth moving to official library?
@slyene6202
@slyene6202 16 күн бұрын
Please, if you have such code, let us see how to create custom nullable arguments (NavType's)!
@cfa532
@cfa532 Ай бұрын
I am using ver rc01 and met a strange problem when passing two arguments in a data class object. The 2nd argument sticks the value of its first time usage, never changes in the afterward calls. I have to use the old way to get around this.
@Dizzyslizzy
@Dizzyslizzy 29 күн бұрын
I used a json + simple kotlin class to get around this. shouldn't need to tho...
@ntikomathaba2662
@ntikomathaba2662 3 ай бұрын
Is this the best navigation for Compose Multiplatform?
@resitsahin7787
@resitsahin7787 4 ай бұрын
Hi Philip, can you make a video about drag and drop of lazy column, i have stuck there. It seems they have recently added this capability.
@andrianbantero3462
@andrianbantero3462 4 ай бұрын
how does this work on a nested navigation?
@sw_a_ppy
@sw_a_ppy 4 ай бұрын
How to handle deeplink with latest navigation update
@arten8281
@arten8281 4 ай бұрын
OP gonna start using jet pack compose now
@amirhosseinghafoorian9985
@amirhosseinghafoorian9985 4 ай бұрын
Cool update 🤩 what I'm more curious about is that how does recommendations work ? is it an extension or a live template or smth ?
@PhilippLackner
@PhilippLackner 4 ай бұрын
Gemini AI suggestions in Android Studio Jellyfish
@rifatkhadafy9786
@rifatkhadafy9786 13 күн бұрын
but what will happen if theres multi module, like screen from Module A want to navigate to Module B and with Multiple Different Object the problem i cant import directly Module B to Module A it will cause circular dependency
@PhilippLackner
@PhilippLackner 13 күн бұрын
@@rifatkhadafy9786 navigation setup doesn't belong in any module that's not the app module. For learning this properly, check my essentials bundle: pl-coding.com/android-essentials-bundle
@Ayor88
@Ayor88 4 ай бұрын
I've add it to my project and it works really well but now I'm flooding with logcat message : "updateAcquireFence: Did not find frame." This doesn't crash the app or anything, but it's really annoying.
@Matthew01369
@Matthew01369 3 ай бұрын
Hi there, did you manage to fix it? It's happening to me also
@vsv8161
@vsv8161 3 ай бұрын
Same problem
@nimishnatani2031
@nimishnatani2031 3 ай бұрын
If I have to pass a data class then how can we do that from this method
@armandoavila4615
@armandoavila4615 3 ай бұрын
Does it work for Multiplatform?
@MrMindfullness
@MrMindfullness 4 ай бұрын
I am not sure how to login to my account and access my course. Please help!
@mehdiparsaei1867
@mehdiparsaei1867 Ай бұрын
Thanks! How about this code snippet? @Serializable sealed class Screens { data object Main : Screens() data class Settings(val username: String, val emailAddress: String) : Screens() }
@MrBzik1111
@MrBzik1111 4 ай бұрын
I wonder how other libraries (mentioned in the comments) can get use out of Parcelable. For KMP. I thought It was only android thing
@EngOsamaMohsen
@EngOsamaMohsen 2 ай бұрын
Is that work in KMP ?
@sijanneupane
@sijanneupane 3 ай бұрын
how to use this with navGraph? since it asks for string in the start destination. and we're passing object here.
@PhilippLackner
@PhilippLackner 3 ай бұрын
Navgraphs are also objects with this change
@quangthaita6084
@quangthaita6084 4 ай бұрын
I realize that the new Compose Navigation version 2.8.0-alpha8 makes navigation with bottom navigation bar lag
@manjodh
@manjodh 4 ай бұрын
I am using this approach with shared element transition. When i am navigating from screen A to B. When entering in Screen B I click back button before transition complete the app is getting crashed.Why it is happening?
@gloooooom6229
@gloooooom6229 4 ай бұрын
hi! how would i do it if i have 2 UI sets for 2 usertypes? i have a radiobutton on the signup to identify them. how can i navigate them to the right set of UIs i already have my bottomnav that has 5 screens
@Jon88938
@Jon88938 4 ай бұрын
Isn't it still not ideal that you have to do NavBackStackEntry.toRoute()? like you could accidentally you use the wrong class surely?
@WilliamAlexandersProfile
@WilliamAlexandersProfile 4 ай бұрын
They fixed navigation. Joy
@patsnow1066
@patsnow1066 4 ай бұрын
Need this in KMM!
@deepaksingh-qd7xm
@deepaksingh-qd7xm 4 ай бұрын
Now I will learn it I has paused my learning
@unknownBoy85lover
@unknownBoy85lover 4 ай бұрын
The android SDK developmented by Google need a lot of changes in most of layers this API's are from them
@Daaaaaaavid
@Daaaaaaavid 4 ай бұрын
How does this look like in a big app with 50+ screens?
@Guilo583
@Guilo583 4 ай бұрын
thanks for video. Is this new lib support compose Multiplatform ?
@zeroarst
@zeroarst 4 ай бұрын
Is there a way to gradually migrate to this meanwhile still keep the current navigation in xml? Simple the current project has large codebase and too difficult to migrate it in one shot.
@СенчуринНиколай
@СенчуринНиколай 4 ай бұрын
It looks fine with two screens, what about popBackStack , popupTo etc, like in fragments ? When nav logic becomes more complex
@PhilippLackner
@PhilippLackner 4 ай бұрын
Works just as easy
@michakazmierczak4464
@michakazmierczak4464 4 ай бұрын
how to use this with multi module project with feature modules not depending on each other just like android recommends?
@mgdhia5696
@mgdhia5696 4 ай бұрын
can i pass model into screen B?
4 ай бұрын
What an improvement!
@뚜릅-i6c
@뚜릅-i6c 4 ай бұрын
Can I use the library normally in kmm? Is it superior to voyager and decompose?
@sw_a_ppy
@sw_a_ppy 4 ай бұрын
Pls make more on this
@laughforlife4569
@laughforlife4569 3 ай бұрын
Then how can we use it with deep link?
@5erTurbo
@5erTurbo 4 ай бұрын
Not completely sure why they need type in `toRoute()` function. I guess it could also be avoided.
@dmytroberezhnyi717
@dmytroberezhnyi717 3 ай бұрын
Heya, Guys, for CMP it does not work, maybe someone have an example?
@rishabhsaraswat1928
@rishabhsaraswat1928 4 ай бұрын
I am a student. I am up to date with most of Android and I am struggling with guidance for more advanced stuff. Since I am a student, can u please tell the price of the 10 week program. I need to start collecting money. I have signed up but haven't received any emails yet.
@safakcelik3173
@safakcelik3173 4 ай бұрын
Is this usable also for KMM?
@alexmercerind
@alexmercerind 4 ай бұрын
Finally we got it!!
The ONLY Correct Way to Load Initial Data In Your Android App?
12:27
Philipp Lackner
Рет қаралды 25 М.
Navigation Compose meet Type Safety
16:50
Android Developers
Рет қаралды 11 М.
小丑妹妹插队被妈妈教训!#小丑#路飞#家庭#搞笑
00:12
家庭搞笑日记
Рет қаралды 37 МЛН
Man Mocks Wife's Exercise Routine, Faces Embarrassment at Work #shorts
00:32
Fabiosa Best Lifehacks
Рет қаралды 5 МЛН
derivedStateOf VS. remember(key) - THIS is Really the Difference 🤯
14:46
Kotlin Multiplatform vs Flutter: Which should we use?
4:42
Kei Fujikawa
Рет қаралды 22 М.
Should You Use Compose State or StateFlow in Your ViewModels?
13:59
Philipp Lackner
Рет қаралды 78 М.
how Google writes gorgeous C++
7:40
Low Level
Рет қаралды 887 М.
ViewModels & Configuration Changes - Android Basics 2023
18:46
Philipp Lackner
Рет қаралды 120 М.
"The Life & Death of htmx" by Alexander Petros at Big Sky Dev Con 2024
23:01
Montana Programmers
Рет қаралды 60 М.
Front-end web development is changing, quickly
3:43
Fireship
Рет қаралды 1,1 МЛН