to anyone whose app crashes when you do this. change the navhost package tag in activity_main.xml to just fragment or your app will crash. thank you so much to the poster of this video. you were very clear and easy to understand. it was just that little detail in the tag that was driving me crazy cuz my app kept crashing. lol. hope this helps someone!
@skyfeelan Жыл бұрын
for me it crashed because I used FragmentContainerView instead of fragment, I changed it to fragment and then it works fine
@Laughing-Pixels9 ай бұрын
Thank you so much!
@zolo3755 ай бұрын
Thank you shinmasterx
@sayanadhikari3220Ай бұрын
@@skyfeelan bro could u just provide this line of code. i am facing the same issue too. can't resolve
@skyfeelanАй бұрын
@@sayanadhikari3220 sorry, but rn I'm on a deadline of something, 😭 and also I forgot the exact location of the project conatining the code pertaining that problem
@justaaq4 жыл бұрын
Very professional . to the point , knows when to slow and when to speed . Followed the tutorial and was able to generate the needed UI . Thanks
@blueicer1012 жыл бұрын
I like this video, not because it's perfect or anything, but it shows someone using android studio and not just writing xml like everyone and their mothers.
@brandondelacruz29334 жыл бұрын
Holy shit, your content is Gold! I thought I was becoming stupid due to listening to those unclear tutorials, but yours was clear and spot on. Thanks man!
@jamieholmes63792 жыл бұрын
Also the java code for the AppBarConfiguartion is; AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(R.id.firstFragment, R.id.secondFragment, R.id.thirdFragment).build(); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
@mohammedabusnaimeh80762 жыл бұрын
question :- if I go from second fragment to third fragment then press back its back to Fragment One(home start destination ) but must be back to second Fragment .why?
@Arman_1272 жыл бұрын
Хорошо что есть переводчик KZbin 😄. Огромное вам спасибо за видео
@evelynediazaraque60953 жыл бұрын
Such an amazing, concise and straight up tutorial! You're a genius, thank you!
@queenvillarin44962 жыл бұрын
BEST TUTORIAL EVER! THANK YOU SO MUCH YOU'RE A LIFESAVER
@johnshepard12674 жыл бұрын
Thanks for the video, exactly what I was looking for!
@edycarreyes994 жыл бұрын
It doesn't work for me!!!... The navigation between fragments doesn't work!.
@crooks50013 жыл бұрын
It's not navigating fragments for me either :(
@andres1f1guti1s3 жыл бұрын
make sure you have the id of each fragment in each menu item: 4:30
@Techavior4 жыл бұрын
4:21 I liked how he selected all (Ctrl + A) then pressed the magic key, then all took his place like a good solders :) I've tried some keys and almost nuke my entire project, then I became like a good solder who must do boring stuff to my project :\
@StevdzaSan4 жыл бұрын
Ctrl + Alt + L
@ryanfosterthemagicegg15672 жыл бұрын
Thanks for making this comment since he replied.
@jacoblee894 жыл бұрын
i thought i was watching a speedrunner in mario maker but good vid tyvm!
@muminoloruntola21464 жыл бұрын
You're a life-saver. Cheers This helped resolve 90% of my problems
@mkc03213 жыл бұрын
short, precise and perfect explanation
@StevdzaSan3 жыл бұрын
Thank you 🙏💜
@telloborneo36354 жыл бұрын
great videos !!, Please make video about handling the backstack, its so difficult for me.., this is my cases, here the flow of navigation graph : 1. A-B-C 2. D-B-F The question is, how the B fragment knows, which fragment that called them, from A or D, i mean how to handle onBackpress, im glad if u have the solution, thanks dude!
@h.r.604 жыл бұрын
Keep up the great work, Legend 🙌
@ApratimArora2 жыл бұрын
What's the reason is used instead of FragmentContainerView??
@imc0der Жыл бұрын
There is confirmed bug (I don't remember what was that) in FragmentContainerView. For now Google suggests use fragment tag if we get bug until fix.
@name1566 Жыл бұрын
@@imc0der Thats true
@maviniii2 жыл бұрын
Thanks so much sir, it's working perfeclty. The only problem that i had was: Kotlin recreted a "Fragment" intead "fragment", and you didnt show us that we needed to create an id on fragment, in the line: 25 of "activity_main". apartfrom that, everything is working. Thanks
@nitin88mehta4 жыл бұрын
Could you please share the source code of the following. I am having trouble importing correct libraries.
@Whothefuckiskevin3 жыл бұрын
This worked for me: val bottomNavigationView = findViewById(R.id.bottomNavigation) val navController = supportFragmentManager.findFragmentById(R.id.fragment)?.findNavController() navController?.let { bottomNavigationView.setupWithNavController(it) }
@Chris-il7kw2 жыл бұрын
Thanks man you saved my project
@tharakhgormaniad98202 жыл бұрын
THANK YOU SO MUCH
@Nokatotedo2 жыл бұрын
Thanks bro. I always crash before use this code
@NiteSeek3 жыл бұрын
Thank you so much my teacher didnt mention the fact that the icon item Id has to match fragment id found in bot nav menu
@seyhmusalatas1740 Жыл бұрын
Amazing work, clear explanation! Thank you.
@pauljohn.ytchannel4 жыл бұрын
The fragment is always re created every time you tap new tab, how to solved that?
@theworldminusraphtheninjat43783 жыл бұрын
@@nevermore5173 how pls help i noticed it and i need help
@nevermore51733 жыл бұрын
@@theworldminusraphtheninjat4378 This is a fairy simple project I discontinued. I used that technique in this app. Take a look: github.com/Re1r0/StudyAssistant Edit: I used a custom library because it looks good. But the same can be achieved using Google's de facto bottom navigation view.
@albertperellacanelles13143 жыл бұрын
I have a problem with this: I have created the fragments, but i have a google maps activity, that i want to add in the navbar. I put it in my:nav.xml and detects that is an activity. When i run my app i can navigate normaly, but when i press in Maps button it crashes. Any solution to implements a normal activity?
@fausto73943 жыл бұрын
Hey you! You're very skilled with these design things! Thank you very much. Such an good explanation also
@usamazafar3372 жыл бұрын
I was stuck with the problem of switching the fragments when pressing the bottom navbar items but when i set the same id of fragments in my_nav and items in bottom_nav (menu) it runs succesfully.
@theisikkala79184 жыл бұрын
Thanks for the great tutorial, I've got it implementet and it works!!! Keep up the good work!
@maleehamuzafar2 жыл бұрын
To the point. Amazing work, thank you for sharing!
@StevdzaSan2 жыл бұрын
You're welcome 😊
@D3r_3k_4 жыл бұрын
oh Thanks! sorry man, but if i want to combinate drawer navigation and bottom navigation with fragments. how would do it?
@computinghub9550 Жыл бұрын
What about `FragmentContainerView`? Should we use that instead from now on?
@ioannismitropoulos67542 жыл бұрын
Nice work, very helpful video
@footballfreak39874 жыл бұрын
Is this a Java tutorial or Kotlin? and plz let us know ahead of time if you will be working with Kotlin or Java i like to stay consistent...Anyways great job sir thanks
@user-ix5jb5jf6m Жыл бұрын
Hello, I have a question, how can I update a values other fragments, for example i have an app that can save some tasks, so i have one fragment to show tasks and another one to set and save tasks, but fragment pages do not refreshed or reload so it problematic to me, to show the added or updated data instead of just switching fragment I am turning off the app and turn un, so how can I solve it?
@Rafael-hk9pg4 жыл бұрын
My BottomNavigationView is not showing up at the bottom, any suggestions?
@jjb51424 жыл бұрын
Awesome like usual, but I prefer Java instead of kotlin. One like.
@StevdzaSan4 жыл бұрын
You can use both of them in one project. Copy Kotlin code and paste it in java class, android studio will automatically convert it to java for you.
@alonsoescamillarc9483 жыл бұрын
Short and useful tutorial thanks a lot!
@lighttangoredox15733 жыл бұрын
why my fragment didnt become class, even though they are class. i already follow all instruction rewacth video 3x. pretty sure im have same code with u. but the app crashed...
@nevermore51734 жыл бұрын
How can we do this inside a fragment and in Java? I tried my best but it won't work
@saravananmanoharan41143 жыл бұрын
Thank you so much for this!
@prasannadeshpande44353 жыл бұрын
Your videos are very helpful. Thank you very much.
@StevdzaSan3 жыл бұрын
You're welcome 👍
@lukefernandez949 Жыл бұрын
Hi there i used your tutorial and it works perfectly but im facing the issue that it seems to override my start activity which is my login activity and launches this bottom navigation activity first each time. Is there any fix to this?
@ericsatriawan674 Жыл бұрын
This is awesome. How about to swipe left and right those 3 fragments? I have no clue
@hisanahsalsabila82484 жыл бұрын
Thanks! for sharing this tutorial, very helpful
@wambunganga2342 жыл бұрын
Great Explanation .Thank you
@Ari-1182 жыл бұрын
It was a nice video but one thing I'd like to bring to your notice is that I didn't get to use app bar configuration object. Action bar's title was changing with just a method which is set up action bar with nav controller and with just one parameter navController. So why did you make that extra instance of app bar configuration?
@pauilegorov2 жыл бұрын
If this code don't work. Perhaps this will help you: val navHostFragment = supportFragmentManager.findFragmentById(R.id.fragment) as NavHostFragment val navController = navHostFragment.navController findViewById(R.id.bottomNavigationView) .setupWithNavController(navController)
@ryderr44532 жыл бұрын
Thank you, this fixed my issue
@ryderr44532 жыл бұрын
Thank you so much for this excellent tutorial
@StevdzaSan2 жыл бұрын
Anytime!
@anudeepananth4 жыл бұрын
The fragments get destroyed when user moves to another fragment... is there a way to save the fragment state with this?
@sambhusbabu4 жыл бұрын
Same issue for me....
@anudeepananth4 жыл бұрын
@@sambhusbabu So what I did was not use this navigation component library, I chose to add fragments and hide/show the other fragment based on user interaction, thus saving the states
@A_S9962 жыл бұрын
Java Code of 7:00 AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( R.id.firstFragment, R.id.secondFragment, R.id.thirdFragment) .build(); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
@Feciboy3 жыл бұрын
Thank you! Helped me a lot!
@allandrifqyputra44222 жыл бұрын
I like your way of explanation
@developerkiwi83684 жыл бұрын
Do you try to add splash screen fragment to this project?
@rockymalobago40753 жыл бұрын
Hello sir what is the your Button navigation dependency?
@ethiomusic31583 жыл бұрын
It is good tutorial. I did all but when I click the icons, the app goes wrong and disappear from the emulator. And when I remove the fragments, I can see the icons but they don't listen at all. And the other thing is, I couldn't get the titles with the icons. Why? Android Studio couldn't detect me where I missed it. Please help me.
@mohammadalameh94342 жыл бұрын
Thank you worked 100% much appreciated !
@StevdzaSan2 жыл бұрын
Glad you like it buddy!
@mohammadalameh94342 жыл бұрын
@@StevdzaSan Hi I just want to ask you if you please this question: I created a button in the home fragment that takes me to a fourth fragment (not included in the navigation bar), and when navigating to another fragment from the bar, and then clicking the home button from the navigation bar, that 4th fragment is still, I want to return to the home.If u can suggest a way.Thanks!
@toBeABetterTranslator3 жыл бұрын
NICE TUTORIAL! But every time I click the menu item, the fragment will be refreshed, causing crash. How am I supposed to deal with it?
@dirtypaws17 Жыл бұрын
If you add setOnItemSelectedListener for the menu, do you need then to manually add the transition to the fragments?
@ShivamMalik953 жыл бұрын
How to not display the text in the menu title? i want to just show the menu icon and not the title text with it take the space
@perfectoctogon23922 жыл бұрын
Get rid of the Title attribute
@ahmedbasalib75983 жыл бұрын
Sir how to stop fragment recreation every time the tabs clicked? When one tab is clicked first time the fragment should be created but when the same tab is clicked second time I don't want to recreate the fragment so is there any way to achieve that?
@cindyliang93673 жыл бұрын
very clear and helpful!
@chil1t011 ай бұрын
Can someone help me? I have the exact same code as the video with, the only difference is that a fragment from a nav_graph to an another activity (HomeActivity) with another (surely in the future) nav_graph navigation. The problem is that all navigation function well but the AppBar and the BottomNavigationView doesn't display at the activity and seems like it only renders the pure fragment with the text. can someone help me?
@uio86a2 жыл бұрын
Can I adjust the size and spacing of the navigation icon? Can I put in Chrome Icon and make the start menu and program list appear like Windows?
@binqiangliang47452 жыл бұрын
We have 3 top-level destinations (first fragment, second ... and third), when I click BottomNavigationView to navigete to second or third fragment, then press the back button, it will always come back to first fragment. Only when I'm in first fragment, press the back button can exit the activity. How to make exit activity when I cpress back button no matter what fragment I'm in?
@ishchuk_ Жыл бұрын
Did you ever find a solution to this?
@spartan102344 жыл бұрын
In Java i tried using AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(R.id.firstFragment, R.id.secondFragment, R.id.thirdFragment).build(); and NavigationUI.setupWithNavController(appBarConfiguration); to update the top app bar. However, android is telling me "Cannot resolve method setUpWithNavController(appBarConfiguration)" does anyone know how to resolve this?
@StevdzaSan4 жыл бұрын
Refer to the comment with highest number of likes
@mrowox4 жыл бұрын
@@StevdzaSan It doesnt change the title when the app navigates to a new fragment. Please look into it. even your code that you ask to refer to doesn't change it
@StevdzaSan4 жыл бұрын
@@mrowox In your nav graph, just change label attribute.
@mrowox4 жыл бұрын
@@StevdzaSan it still shows the same thing. I really can't figure out what is wrong because I am new to this
@sinbobey393 жыл бұрын
Here it is: Set topLevelDestinations = new HashSet(); topLevelDestinations.add(R.id.firstFragment); topLevelDestinations.add(R.id.secondFragment); topLevelDestinations.add(R.id.thirdFragment); AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(topLevelDestinations).build(); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
@reinhardkenson4 жыл бұрын
val appBarConfiguration=AppBarconfiguration(setof(R.id.firstFragment,R.id.seconfFragement,R.id.thirdFragement)); setupActionBarWithNacController(navController,appBarConfiguration) im have trouble to fine the equivalent syntax in JAVA Can Any one help me out
@sinbobey393 жыл бұрын
Here it is: Set topLevelDestinations = new HashSet(); topLevelDestinations.add(R.id.firstFragment); topLevelDestinations.add(R.id.secondFragment); topLevelDestinations.add(R.id.thirdFragment); AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder(topLevelDestinations).build(); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration);
@mamaminiepozwoliaukrzyska67743 жыл бұрын
@@sinbobey39 very helpful for java code
@ferranescolano64914 жыл бұрын
Right now im having problems because the activity_main_fragment.xml is supposed to have instead of , do you know how to handle this?
@leonardocorreiadecastro57013 жыл бұрын
Thanks for help, you are my hero
@ManishKumar-lr9ig2 жыл бұрын
I have one question . If I want to add two fragment in profile tab ... how to do that
@hatty1013 жыл бұрын
Does bottom nav view have any perofmance impact? i mean i have 4 views and i want the user to be able to switch between them. tab layout vs bottomnavview?
@aelafdev3 жыл бұрын
another applauder!!! thank you
@mohamadmf41053 жыл бұрын
4:22 to 4:23 What did input on keyboard to change coding style?
@aozgunn3 жыл бұрын
Hi nice tutorial. How can I add gridView in Home Fragment ? I can create gridView other app in mainActivity bu I can't open gridView when I clicked home icon.
@AlanBlay3 жыл бұрын
It's possible to save the state of the fragments between transition of fragments with this code?
@harshpatel-bt5wr3 жыл бұрын
how can we handle multiple navigation graph for managing multiple backstacks
@abdremo4 жыл бұрын
Very nice, thanks so much
@pvelasquez2 жыл бұрын
can you change the blue color of the selected item?
@nishaposwal25123 жыл бұрын
create destination is not working for me....is there any dependency needed?
@sjjayaswal76212 жыл бұрын
Thanks for information 👍
@utksingh74 жыл бұрын
how can I set a particular fragment as the starting fragment....which appears first on opening app
@DavisTibbz4 жыл бұрын
You are the best!
@brunooliveira39317 ай бұрын
Please if anyone can answer me. How to customize the toolbar according to the fragment I am in?
@timverlinde89543 жыл бұрын
Thumbs up for you my friend. Thank you!
@neoviray72483 жыл бұрын
why I cant run this project it keeps on crashing, I did it the way he did it I just follow these step by step
@jeanmichel42693 жыл бұрын
I have the same problem right now :'( did you find the solution?
@YoumojoJoJo3 жыл бұрын
I want to add the bottom navigation in a fragment?
@theworldminusraphtheninjat43783 жыл бұрын
I have a question how do I stop the bottom navigation from recreating the view when its selected and I keep clicking on it like in your example if you keep clicking on any of the items it will keep recreating the corresponding fragment ?
@sambhusbabu3 жыл бұрын
Same problem... Help me to fix this issue
@Normatov3 жыл бұрын
how to make all the text on the button visible, the text on the button should be visible even if you do not press the button.
@Normatov3 жыл бұрын
please help me
@Normatov3 жыл бұрын
Stevdza-San
@abdnezar58723 жыл бұрын
awesome bro > but how i can pass args from fragment to anther ??
@ademkayaaslan65123 жыл бұрын
Could you find your question's answer?
@albertomagalhaes51182 жыл бұрын
How can I add transition animations between those fragments?
@musasoydas3122 Жыл бұрын
thank you
@pandakaradi49594 жыл бұрын
Thx for the video. There is no tutorial like this if possible do that creating a list item with images from previous activity with eduit text and listview
@claire32644 жыл бұрын
Hi Stevdza-San I have error which is unsolved reference: R Can you help me to solve this problem please?
@blueroaster83842 жыл бұрын
hmmm when i call the menu instead of getting the icons i get the 'first fragment' wording
@azizagasi78872 жыл бұрын
I got a bug because of this, when I click on back button instead of closing the app the activity gets recreated again
@brandondelacruz29334 жыл бұрын
Can you make a tutorial about the basics and advance tricks with recyclerView? I already know the basics, I just dont know how to make each element become clickable and have separate pages for each element each time theyre clicked.
@fausto73943 жыл бұрын
Hello sir, did you found it? I can help with that if you want!
@vapecat3 жыл бұрын
How to make the bottom navigation disappear when i open another fragment?
@dryanwarrener3 жыл бұрын
Yo, my fragment overlaps my navbar. How do I fix that?
@deepeshkumar1704 Жыл бұрын
may bottom navigation, navigate by swiping with Navigation component??