Nested Navigation with Bottom Bar and Jetpack Compose | Android Studio Tutorial

  Рет қаралды 42,821

Stevdza-San

Stevdza-San

Күн бұрын

Пікірлер: 151
@Gtry-pc1bg
@Gtry-pc1bg 2 жыл бұрын
Omygod, You really explain my number 1 problem for the last 2 months. You really are great
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks buddy
@maciejjaremowicz2646
@maciejjaremowicz2646 6 ай бұрын
@@StevdzaSansame for me, great video man
@milanglisic7663
@milanglisic7663 Жыл бұрын
Pa ti si nas! Auu jebote, najaci smo. Hvala ti na ovome tutorijalu. Samo napred!
@AiGirlzzandBoyzz
@AiGirlzzandBoyzz 4 ай бұрын
Thank you so much , I've been stuck in this part for over a week and finally I found your video .
@AliAhmad-dev
@AliAhmad-dev Ай бұрын
This was a problem for me, but now it is easy. Thank you
@dusanperic
@dusanperic Жыл бұрын
Hvala brate, baš mi je ovo trebalo, imaš odlične videe o Jetpacku, samo tako nastavi!
@shubhanshusharma5372
@shubhanshusharma5372 Жыл бұрын
I dont comment usuallly but this video help me in my many projects i always watch this video and your code . Thanks for this video
@rahulchandrabhan
@rahulchandrabhan Жыл бұрын
such a perfect playlist for understanding jetpack compose navigation. Thank You
@wuguo755
@wuguo755 Жыл бұрын
Great Job! Thank you very much! I am your student for learning jetpack compose from the beginning! Obvious and beneficial explanation. Expect more videos in the future!
@akpapps5988
@akpapps5988 Жыл бұрын
How to implement a logout from the profile in the bottom nav screen? It has a different controller. And auth in other controller. Then how to navigate?
@mauliktogadiya2500
@mauliktogadiya2500 Жыл бұрын
same question..found anything???
@fi8er1
@fi8er1 Жыл бұрын
@@mauliktogadiya2500 ??
@ArturoDevA
@ArturoDevA 4 ай бұрын
solutions is use a lamdda , from HomeScreen to RootNavGraph, works perfect
@nuralijakipov3585
@nuralijakipov3585 22 күн бұрын
@@mauliktogadiya2500 did you fing the answer to this question?
@caniggiasyabil470
@caniggiasyabil470 9 ай бұрын
you could achieve such functionality much easier with scaffold and tabrow. The question is how to do it on xml? nice video btw
@mraja6654
@mraja6654 10 ай бұрын
Really awesome 🎉
@maqcoders8148
@maqcoders8148 Жыл бұрын
Thanks for making this video, it means a lot to us. I was looking for the same scenario but found no solution in XML. can you please make a video for the same using XML? it will be very helpful for us. BTW You did a great job and I appreciate this. Thank You!
@zakariajawas
@zakariajawas 2 жыл бұрын
This is very helpful, but i have a question how to go from Home to Auth again incase of Logout ?
@mungai7534
@mungai7534 Жыл бұрын
Was just looking for this, thanks!
@satnamsingh-qh2si
@satnamsingh-qh2si 10 ай бұрын
Great video for navigation. Can you make videos on how to scope viewmodels to composable in jetpack compose projects?
@thatcrazymf7658
@thatcrazymf7658 2 жыл бұрын
Hey Stev, you really need to create a video about a nested navigation drawer!
@frax84
@frax84 2 жыл бұрын
I've been one of the "many messages asked me for". Thank you very much for this nice feedback :)
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Glad to help buddy 👍
@vitalijuskolinko9011
@vitalijuskolinko9011 2 жыл бұрын
Thanks a lot! I am gonna try to implement such navigation for my project in the near future. Your video gonna help me a lot )
@StevdzaSan
@StevdzaSan 2 жыл бұрын
I'm counting on that! 🙌
@AndrewDChristie
@AndrewDChristie 2 жыл бұрын
Thanks!
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks Andrew!
@albertomunoz4469
@albertomunoz4469 2 жыл бұрын
Thanks a lot for all the series on Compose navigation! I have a question, if i want to navigate back from the nested NavHost / NavController with the Bottom Bar to the previous (back to the NavHost / NavController for the Login) , but not using the back hard button but with a clickable in the "HOME" Text for example, how would it be the code inside this clickable { ... } ? I still wasn't able to make it work. Great work and thanks again!
@albertomunoz4469
@albertomunoz4469 2 жыл бұрын
I'm passing the parent NavHostController to the nested one and used it to navigate + popUp back. That made the trick. Then passed a "onNavigateBack" lambda and that feels more clean now.
@gtry-in8kc
@gtry-in8kc 2 жыл бұрын
Hello thats what Im trying to solve now. So you mean is from RootNavGraph you will pass the NavController to the HomeScreen?
@DavidBrunk-l9i
@DavidBrunk-l9i Жыл бұрын
how would you then navigate back to the auth graph, say for a logout button that was pressed in the home graph?
@soheiboz522
@soheiboz522 6 ай бұрын
did find the solution ?
@ArturoDevA
@ArturoDevA 4 ай бұрын
@@soheiboz522 solutions is use a lamdda , from HomeScreen to RootNavGraph, works perfect
@trekimpossible2850
@trekimpossible2850 Жыл бұрын
Since HomeNavGraph is a nested navigation, it could be implemented with navigation extension function. May I know the reasoning to use NavHost?
@clementjoymasinamela4244
@clementjoymasinamela4244 Жыл бұрын
I'm thinking the same, let me try it. If I fail, I will tell you the reason.
@cajoncollection3826
@cajoncollection3826 2 жыл бұрын
So well explained thanks for putting it up! And I guess the jetpack navigation component will handle the back stack for you? And no need to handle it ourselves if we want to remember the screen navigation?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Well it's a stable library now, but you'll have to think of how many screens you want to keep in the back stack.
@tunahanbozkurt9516
@tunahanbozkurt9516 Жыл бұрын
How can we achive same behaviour by using xml ? I couldn't find any example. Should I use multiple NavHost Fragments ?
@adjimaingame
@adjimaingame Жыл бұрын
Thank you for the tutorial! I've implement this navigation bottom bar with nested navigation on my project. But I'm having trouble. While on the Home Screen, the bottom bar keeps recomposing. I noticed it when elevation kept blacking out and logcat kept showing the message "The application may be doing too much work on its main thread.". My application also became very heavy. Do you have a solution regarding this?
@andrewbeechey7246
@andrewbeechey7246 Жыл бұрын
Hi, great video, it has inspired me to investigate jetpack compose navigation in my current app using BackdropScaffold, sadly i cannot work out how to make the backdrop and toolbar disappear when the user navigates to my sub graph. I cannot see how to use your approach of conditionally displaying the bottom nav and applying that to hiding the entire backdrop. please help me if you have time :D
@mattiapavese4465
@mattiapavese4465 Жыл бұрын
that was very useful, thank you!
@daniilvladimirov2457
@daniilvladimirov2457 2 жыл бұрын
A great tutorial as always! Whaiting for your new course, can you give a clue when will it be?)
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks 👊 Hmm I will do my best to complete it at the beginning of July 🤔 More information about it, when it's done. 😎
@druom69
@druom69 8 ай бұрын
Приятно слушать! Спасибо за видео
@hohoday2664
@hohoday2664 2 жыл бұрын
Really Fxxk nice I love you Stevdza-san !!! I really need this viedo thanks!!
@ahamedrizwan2053
@ahamedrizwan2053 Жыл бұрын
Nice brother Could you create another video demonstrating how to navigate to a specific compose screen when clicking a notification in a nested graph?
@chil1t0
@chil1t0 9 ай бұрын
Hi, Stevdza, now that jetpack compose has a different way to handle the BottomNavigation with a rename and refactor of the composable as BottomBar, the function extension RowScope.AddItem doesn't work properly because the class BottomNavigationItem doesn't exist anymore, is there a fix to that?
@Sadiqueeeeeeee
@Sadiqueeeeeeee 7 ай бұрын
I agree. In his last video on bottom navigation, I was encountering the same problem. Better use NavigationBar and NavigationBarItem from material3 in place of BottomNavigation and BottomNavigationItem
@cufflink919
@cufflink919 4 ай бұрын
@@Sadiqueeeeeeee This also fixed my issue with the dark theme icons not showing. Thank you!
@vladimirpopov8151
@vladimirpopov8151 Жыл бұрын
Thanks a lot. Great explanation of the theme!
@bedresamarth
@bedresamarth 3 ай бұрын
I had a question. How do you go back to the authNavGraph if I log out from the homeNavGraph?? Kindly give me advice on this as I am stuck
@rakibhasan_
@rakibhasan_ Ай бұрын
Same here
@rakibhasan_
@rakibhasan_ Ай бұрын
What if I need to navigate from HomeGraph to AuthGraph? Specifically, if I want to log out from the HomeGraph, clear the entire HomeGraph, and then navigate to the AuthGraph, how can I handle this if the NavController used in the HomeGraph doesn't know about the AuthGraph?
@johanngeisser6109
@johanngeisser6109 Жыл бұрын
Thanks, it was very useful
@mamhesam
@mamhesam 2 жыл бұрын
Thank you so much for your great tutorial. Here, if I want the bottom navigation to be shown in the graph detail and navigate to the profile item in the bottom navigation and navigate to the home item in the profile , how can I still be on the information page. Like the bottom navigation of the Instagram app. that each bottom navigation item displays the last page. Thank you for your answer
@vikashparajuli
@vikashparajuli 2 жыл бұрын
Well explained. Thanks for the tutorial.
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Glad to help 👊
@Anolcera
@Anolcera 2 жыл бұрын
what if we want to navigate from HOME nav graph back to the Auth ?
@yossimaskin1393
@yossimaskin1393 Жыл бұрын
The problem with this approach is that as you mentioned, you have to use separate navControllers and in this case you cannot navigate from the inner graph to the auth graph in cause you need to logout for example. I didn't find a solution to it
@BinuJasim
@BinuJasim Жыл бұрын
Can't you do a two step routing? First go to the root of the inner graph & then go to the authentication. Does that work?
@yossimaskin1393
@yossimaskin1393 Жыл бұрын
@@BinuJasim I solved this by passing 2 nav controllers to the inner graph, the root one and the other of the bottom navigation but it's a kind of dirty workaround
@swiszcz93
@swiszcz93 Жыл бұрын
omg i'm having this problemmmmm
@BinuJasim
@BinuJasim Жыл бұрын
@@yossimaskin1393 Fine that works. Another solution is to use a single navcontroller only and define the homescreen graph as an extension function of NavGraphBuilder just like how the authentication graph is defined. This way there is only a single NavHost, so all the navigation information will be available in the navcontroller backstack. You can navigate to any route as well.
@krishnankv7894
@krishnankv7894 9 ай бұрын
​@@yossimaskin1393 can u please share the details am facing that same problem
@_AG8
@_AG8 24 күн бұрын
Once you logged in, how can you delete the main NavGraph backstack so you can't go back to the LoginScreen?
@chadisfeir3809
@chadisfeir3809 6 ай бұрын
thank you for this tutorial! question: if we have logout button in profile screen where we should navigate to auth graph, don't we need to pass the root navcontroller to main graph in this case ?
@ankitkhyalia3194
@ankitkhyalia3194 5 ай бұрын
Have you found the solution of this?
@chadisfeir3809
@chadisfeir3809 5 ай бұрын
@@ankitkhyalia3194 yes just call the auth graph roote using the app navigation and popup the stack
@ArturoDevA
@ArturoDevA 4 ай бұрын
@@chadisfeir3809 please friend share your code
@justmeagain9302
@justmeagain9302 4 ай бұрын
@@chadisfeir3809 will this work even after relaunching the app?
@dabdelkarim
@dabdelkarim 7 күн бұрын
@@chadisfeir3809 do you mean something like the following fun HomeNavGraph(rootNavController: NavHostController, homeNavController: NavHostController) { ...... ...... composable(route = BottomBarScreen.Profile.route) { ScreenContent( name = BottomBarScreen.Profile.route, onClick = { rootNavController.popBackStack() rootNavController.navigate(Graph.AUTHENTICATION) } ) } I also tried to use homeNavController.popBackStack() instead of rootNavController.popBackStack() but it did not pop the stack!!
@moammarqaddafi4858
@moammarqaddafi4858 9 ай бұрын
Can you please do something like that with XML method without jetpack?
@mouzamali2940
@mouzamali2940 Жыл бұрын
Great explanation
@MonichGPT
@MonichGPT 4 ай бұрын
Nested NavHost cause visual bugs in compose 1.7.
@Fighterkampfer
@Fighterkampfer 7 ай бұрын
Thank you very much! Just one question, what happens if you want to navigate from the Details screen back to the root graph ? For example, like a "logout" option that must show GRAPH.Authentication again. Will you use the navController at RootNavigationGraph ? And how would you provide it to the details screen ?
@meetb26
@meetb26 7 ай бұрын
one problem show
@meetb26
@meetb26 7 ай бұрын
pass mainNavController in detail page after that mainNavController .navigate(AuthScreen.Login.route)
@AbdallahMehiz
@AbdallahMehiz Жыл бұрын
having multiple navigation graphs results in a lot more boiler plate and more points of failure, current compose navigation is by all means, not ready for production
@sinancode
@sinancode Жыл бұрын
its very important thanks
@StevanMedic
@StevanMedic Жыл бұрын
Bravo imenjace :) Podrska
@maxose
@maxose Жыл бұрын
Hi thanks for guide. I faced with problem: how I can pass argument to details navgraph
@davidavalishvili2768
@davidavalishvili2768 2 жыл бұрын
great video. thanks. what about to send custom parcelable arguments from one screen to another?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
I've already made a video about passing a whole object, check my videos.
@gamigforgamers
@gamigforgamers Жыл бұрын
Amazing video! keep it up
@vrindavankiras
@vrindavankiras 8 ай бұрын
sir what about inner-padding value in scaffold for home , profile and setting screen or what i can do so that not need to pass this innerpadding value to all top label screen?
@bakersbinary
@bakersbinary 9 ай бұрын
Great, thank you
@emmanouilboursalis3912
@emmanouilboursalis3912 Жыл бұрын
Hello sir and thank you for the video. May you show as how to pass arguments on nested navigation? I am trying to do it on my own but i can't.
@ngomdecadetkamdaou3464
@ngomdecadetkamdaou3464 2 жыл бұрын
Awesome, this was helpful
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Glad to hear that buddy 💪
@420Sumanta
@420Sumanta Жыл бұрын
How to handle duplicate navigation when the user clicks on the same NavigationBarItem twice?
@N-fo4nq
@N-fo4nq 9 ай бұрын
Have you found the solution for that?
@420Sumanta
@420Sumanta 9 ай бұрын
nope. this is really frustrating @@N-fo4nq
@ApratimArora
@ApratimArora 2 жыл бұрын
How can i achieve this without jetpack Compose? I still build apps using XML layout and kotlin. Kindly suggest me some article or youtube video..
@marta_na_moto
@marta_na_moto Жыл бұрын
Thank you kind soul.
@kannanramakrishnan3052
@kannanramakrishnan3052 Жыл бұрын
thank you
@JohannGeisser-d9m
@JohannGeisser-d9m Жыл бұрын
Excellent, but I can not seem to navigate again from Home screen to AuthGraph
@HendrawanDev
@HendrawanDev 2 жыл бұрын
Clear and well explained tutorial! Btw, i have a case in my android app that similar to the example in this video. So, in my case, the information screen has BottomAppBar component. How i can implement that? Do i need to place the BottomAppBar in parent scaffold? or place it on InformationScreen?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
I suppose you should place it in another nested graph like you have seen in this video
@HendrawanDev
@HendrawanDev 2 жыл бұрын
@@StevdzaSan So i have to create another BottomAppBar inside InformationScreen and hide the BottomAppBar from parent? If so, i believe it will works, but the structure of composition will be like this Scaffold --Content ----Scaffold ------bottomBar is Scaffold inside Scaffold normal?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Haven't done that kind of logic yet, so would have to experiment in order to find the best possible solution.
@HendrawanDev
@HendrawanDev 2 жыл бұрын
@@StevdzaSan the bell already on, waiting for your next video. Keep it up!
@thomasgohringer5538
@thomasgohringer5538 2 жыл бұрын
@@StevdzaSan Are you planning on making a video on this? I haven't found any resources on how to achieve this behaviour so far.
@onahchristian2684
@onahchristian2684 Жыл бұрын
Just Superb...
@nipunshah1373
@nipunshah1373 2 жыл бұрын
1 Doubt : What is difference between `navigation` & `NavHost` ?
@francoisrochefort5759
@francoisrochefort5759 2 жыл бұрын
Very nice thank you
@HariKrishnan-es6po
@HariKrishnan-es6po Жыл бұрын
Hi, Stev, How to call a interface method implemented in main activity from composable function.
@saeedzia5579
@saeedzia5579 8 ай бұрын
how can i go from home screen to login screen???? scenario: User logout from setting screen and now i want to open login screen.
@yahussainmazloom1
@yahussainmazloom1 Жыл бұрын
Best Great Job brother
@tripabroad8918
@tripabroad8918 Жыл бұрын
How to handle case if I don't need to hide bottom bar and want to save tab icon selected?
@vickramodero6971
@vickramodero6971 9 ай бұрын
This doesn't work anymore. only a single NavHost per NavController is allowed. So, how do I achieve this?
@eiorajlf
@eiorajlf Жыл бұрын
how to go back to root nav graph from home nav graph
@mauliktogadiya2500
@mauliktogadiya2500 Жыл бұрын
Did yo find solution ? What if we have logout like feature and want to clear current graph and navigate to auth graph?
@manuelfernandezgarcia2908
@manuelfernandezgarcia2908 8 ай бұрын
What if i want to open the login screen from the home screen again? Imagine that i logout.
@ovedgustavorinconmachado506
@ovedgustavorinconmachado506 4 ай бұрын
Why is slower my app in compose than in xml?
@khumokwezimashapa2245
@khumokwezimashapa2245 2 жыл бұрын
Hello. Do you have a video on how to dowload images using glide? I managed to use glide to show my Firebase images in recyclerview, but now I want to download those images into device internal storage.
@cuiteleo
@cuiteleo 2 жыл бұрын
Best
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks
@mubashirpa
@mubashirpa Жыл бұрын
what should do if i want to log out and go back to login screen?
@javasync
@javasync 2 жыл бұрын
Thank you so much!!!!
@StevdzaSan
@StevdzaSan 2 жыл бұрын
You're welcome! 💜
@nuralijakipov3585
@nuralijakipov3585 22 күн бұрын
is it clean code or not?
@progdeelite
@progdeelite 2 жыл бұрын
Super nice and well explained. #top
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks buddy 🙌
@TriNguyen-ym3hf
@TriNguyen-ym3hf 2 жыл бұрын
I have a question, when i navigate from bottomNavRoute to other Route, callback "OnDestroy" from lifecycle doesn't triggered (only call onStop), and when I navigate back using popBackStack, bottomNav triggers onCreate instead of onStart. That rlly weird, can you tell me what is the problem here, thank.
@TriNguyen-ym3hf
@TriNguyen-ym3hf 2 жыл бұрын
@GeishaTheSerpantClan jetpack compose sir
@digvijayshelar8609
@digvijayshelar8609 Жыл бұрын
can anyone help me with the thing that bottom bar start destination works but onboarding screen doesnt work due to that
@jopadjr
@jopadjr 2 жыл бұрын
184th...I am a subscriber of your Udemy courses and nice to see your YT videos here.
@roonyshekho8067
@roonyshekho8067 2 жыл бұрын
How can I change the background color of a bottom navigation screen?
@zakariajawas
@zakariajawas 2 жыл бұрын
pass backgroundColor to the BottomNavigation()
@roonyshekho8067
@roonyshekho8067 2 жыл бұрын
@@zakariajawas I meant the screen not the bottom navigation itself. It can be changed using background color attribute in scaffold.
@olukayodepaul7070
@olukayodepaul7070 2 жыл бұрын
You are bless.....
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Thanks 💜
@olukayodepaul7070
@olukayodepaul7070 2 жыл бұрын
Just implemented it.. it works like magic. Thanks
@StevdzaSan
@StevdzaSan 2 жыл бұрын
@@olukayodepaul7070 Good job buddy 👏
@andikitta9480
@andikitta9480 2 жыл бұрын
how to logout?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
Logout what? 🤔
@andikitta9480
@andikitta9480 2 жыл бұрын
@@StevdzaSan after press login button, we enter to the mainscreen, so my question is, how to logout back to the authentication screen from the mainscreen?
@StevdzaSan
@StevdzaSan 2 жыл бұрын
@@andikitta9480 Well if you pop the Authentication graph of the backstack, you can just explicitly navigate to that same graph again with navigate function.
@StevdzaSan
@StevdzaSan 2 жыл бұрын
And you can create the logic to dynamically calculate whether to show Home graph or Auth graph as a start destination based on the value saved in the app preferences for example. Bottom line, there are multiple ways...
@renanboni7636
@renanboni7636 2 жыл бұрын
@@StevdzaSan there are multiple ways, could you please elaborate one? neither of what you said above will work, thank you
@hasanbestbits
@hasanbestbits Жыл бұрын
Great video !!!, How did you solve the problem where when you navigate to the details screen and even if you hide the bottom navigation bar it's still visible without the icons and occupies space in the screen ?
@AndrewDChristie
@AndrewDChristie 2 жыл бұрын
Thanks!
Passing Complex Objects between Screens is BAD! - Here’s Why
2:30
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 45 МЛН
Крутой фокус + секрет! #shorts
00:10
Роман Magic
Рет қаралды 29 МЛН
How To Get Married:   #short
00:22
Jin and Hattie
Рет қаралды 27 МЛН
Inside Out 2: ENVY & DISGUST STOLE JOY's DRINKS!!
00:32
AnythingAlexia
Рет қаралды 15 МЛН
25 - Nested NAVIGATION - Android Jetpack Compose
16:07
Mohsen Mashkour
Рет қаралды 7 М.
Bottom Navigation with Jetpack Compose
15:29
Stevdza-San
Рет қаралды 53 М.
Full Guide to Nested Navigation Graphs in Jetpack Compose
12:01
Philipp Lackner
Рет қаралды 65 М.
Navigation Basics in Jetpack Compose
14:40
Stevdza-San
Рет қаралды 66 М.
Type-Safe Nested Navigation in Jetpack Compose | Ultimate Guide
12:39
Himanshu Gaur
Рет қаралды 1,9 М.
Support Multi-Screen Sizes in Jetpack Compose
12:00
Ahmed Guedmioui
Рет қаралды 2,1 М.
小天使和小丑太会演了!#小丑#天使#家庭#搞笑
00:25
家庭搞笑日记
Рет қаралды 45 МЛН