BottomNavigationView with Navigation Component - Android Studio Tutorial
Why Stack Overflow recommends it
Stack Overflow users link it as the tutorial they followed, or point newcomers to it, when setting up bottom navigation with the Navigation Component.
Recommended by 3 people across 3 different months, 2020 to 2023.
What it is
A short Android Studio tutorial by Stevdza-San showing how to add a BottomNavigationView to an app and wire it to the Jetpack Navigation Component using a menu resource and a nav graph with fragment destinations. It is a screen-recorded Kotlin walkthrough from 2020.
What people said
Recommends Dan Abnormal · 2021-01 · Stack Overflow · on “Kotlin - fragment lifecycle navigation issues; why does child fragment become current destination?”
Kotlin/Android novice. Please bear with me. My app has the following navigation scheme: BottomNavigationView with navigationController where fragment One, Two and Three are "top destinations", from which I look to navigate further down in the navigation hierarchy. I implemented the scheme following this video tutorial [this video] . [LINK] MY ISSUE Fragment Three is a QR-code scanner. Upon successful scan I aim to navigate to fragment X. However, when I reach the point of navigation, fragment X has become currentDestination ( findNavController().currentDestination ) and the navigation fails with error java.lang.IllegalArgumentException: Navigation action/destination action_fragmentThree_to_fragme
Recommends Akira Kusama · 2021-03 · Stack Overflow · on “Hidden Bottom Navigation View regardless of appearing in the xml”
Summary I try to make Bottom Navigation View with Java and android studio. However, it disappears the bar regardless of showing exact screen in the xml file. Goal I'd like to show BottomNavigationView like this video [this video] . Goal screen is below picture. [LINK] Issue I am coding the video [this video] , and done. The xml file is exact screen layout, but when I build the screen, I saw different layout. What I try Compared to the code, almost all code isn't different. Also turn off the fragment code, it works. I guess the reason why it is disappear must be layout. However, when I change the number of width or height, it shows same screen. What's more, when I use layout construction such as Linerl
Recommends Seng Phrakonkham · 2022-03 · Stack Overflow · on “Single Activity with multiple fragments”
You can add Fragments and navigate. First of all yu need a navigation: In the left hand side on Android Studio you can find the Resource Manager Then click to Navigation then click to + and choose the Navigation resource file After this you can add fragment to the navigation: New Destination (green +) (Don't forget to give name to your fragments). After this you can add the navigation to your activity's xml. You should use the app:menu=”@menu/bottom_nav_menu” code in your xml Here a video about the process: [this video]
Cites Petr Grenar · 2020-09 · Stack Overflow · on “How to add MapBox map into the fragment in bottomnavigation | Kotlin”
I am trying to add a map to my Android App. I have created basics bottom navigation the same as in this tutorial: [this video] . I have only added two fragments. Now I want to add MappBox map into one of them. I am following the Mapbox quick start guide here: [LINK] Everything works fine, but problem is that the Map is not working. When I add the map to the main activity XML, the map loads and works. But when I add the map to one of the fragments, the map does not load. I only see the guides when I hold ctrl in the emulator. This is the fragment with map in in: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android=" [LINK] " xmlns:app=" [LINK] " x
Cites juliussin · 2021-06 · Stack Overflow · on “How to pass data between Intent with NaviationUI Java Android Studio”
I'm trying to make a navigation using NavigationUI as in this tutorial video [this video] . Below is code for my activity: BottomNavigationView bottomNavigationView = findViewById(R.id.bottomNavigationView); NavHostFragment navHostFragment = (NavHostFragment) getSupportFragmentManager().findFragmentById(R.id.fragmentContainerView); NavController navController = navHostFragment.getNavController(); AppBarConfiguration appBarConfiguration = new AppBarConfiguration appBarConfiguration = new AppBarConfiguration.Builder( R.id.dashboardMerchant, R.id.listMenuMerchant, R.id.addMenuMerchant).build(); NavigationUI.setupActionBarWithNavController(this, navController, appBarConfiguration); NavigationUI.setup
Cites Sagar Gupta · 2023-03 · Stack Overflow · on “trying to move between fragments with bottom navigation view _Kotlin”
You can use the Jetpack navigation component to new setup BottomNavigationView. Here's how you can set it up: Create a nav_graph and add all your four fragments as destination. You don't need to create directions betweem them since they'll be connected via bottom navigation. Add com.google.android.material.bottomnavigation.BottomNavigationView in the Activity that host your host fragment and set set menu items. Your code will look something like this: <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android=" [LINK] " xmlns:app=" [LINK] " android:layout_width="match_parent" android:layout_height="match_parent" app:layout_behavior="@string/appbar