Questions tagged [android-navigation-graph]

303 questions
1
vote
1 answer

Action is not generated in FragmentDirections when Fragment is used in a second nav graph

FragmentA is used in nav_graph_first and all the respective action methods/navigations are created in FragmentADirections but when FragmentA is used in nav_graph_second additional navigations are not generated in FragmentADirections. Why? Is this a…
1
vote
1 answer

Android Navigation back button dispatcher wierd behaviour

I'm using the Navigation Components and am trying to just listen to the back button from a fragment; Before listening, everything works fine meaning both the toolbar button and the native back button navigate to the previous fragment as…
1
vote
0 answers

FragmentContainerView: Fragment from NavigationGraph does not inflate

So, I was following the Google's Kotlin Fundamental Course and on topic 3.2 (Add Navigation Drawer), creating the XML file where I added a fragment as NavHostFragment, it gave me a warning to replace it with FragmentContainerView which I ignored but…
1
vote
1 answer

Can nested NavHosts both be the default nav host (defaultNavHost="true")?

I implemented a navigation structure using two nested NavHostFragmentss. I want the back button to first pop the navigation stack of the child Fragment's navigation graph, and then once back to the start, pop the parent Fragment's graph. This…
1
vote
1 answer

Android Navigation Component - Why add arguments in the navigation graph?

I've been following CodingWithMitch's tutorial (and github code) to Navigation Component, but used Java instead of Kotlin. That hasn't brought any issues however. My question is, without using Safe Args, what is the point to adding arguments in…
1
vote
2 answers

Android Navigation Graph, Nested Graph Issue

I hope you're all doing well. I have a problem about navigation graphs. You can see the structure in the image below; So we have 2 different navigation graphs; navigation_A and navigation_B. I need to navigate to Fragment Y and Fragment Z from a…
1
vote
1 answer

Navigating back with the Navigation Component

in the following, you can see the navigation graph of my first activity hosting some fragments (Fragment A, B & C): Here is the XML of this navigation graph:
1
vote
1 answer

Android Navigation with nested bottom navigation

I'm new to Android Navigation Component and want to understand how can I use it in my relatively simple scenario where I want to have a single activity approach. I obviously want the system to handle the back stack, also for bottom navigation. What…
1
vote
1 answer

How to implement a navigation controller within a child fragment?

I have a navigation controller fragment defined inside my activity_main that has a match height and width of parent. So when I navigate between fragments, it replaces the entire screen. Now say I navigate to a fragment that loads up a material card.…
QThompson
  • 1,599
  • 3
  • 16
  • 40
1
vote
2 answers

ViewModel is cleared on on back press

I'm using navigation graph to navigate between fragments and I noticed that my viewModel is cleared (onCleared) only when I press the back button, but not when I navigating to another fragment using this code: val action =…
Sharas
  • 1,985
  • 3
  • 20
  • 43
1
vote
0 answers

BackPressed via Fragment to previous Fragment-Navigation Component

I want to ask: From childFragment to the previous Fragment, BackPressed() is allowed while using Navigation Component, androidx, Kotlin. What I was trying to code is to navigate fragments and bottomNavigation. In one fragment, I used child fragments…
1
vote
0 answers

How to stop repeating to set the same attribute to actions in Navigation Graph?

I have already set six fragments in my Navigation Graph. Each fragment looks like this:
1
vote
1 answer

NavController destination unknown using BottomNavigation

I'm using BottomNavigation in the main menu class to cycle through Fragments in the main screen. The weird thing about this is my app crashes because NavController doesn't find the destination in one of four fragments. MainMenuFragment is not the…
0
votes
0 answers

Cannot transition entry that is not in the back stack, but currentBackStack.value shows that it is

I'm trying to programmatically go back to the Fragment that called another Fragment. Inside the called Fragment, I used findNavController().popBackStack() to try to got back to the previous Fragment in the backstack, but I'm getting the error I…
rminaj
  • 560
  • 6
  • 28
0
votes
1 answer

Need to use handler.postDelayed returning from a DialogFragment using navigation component return with a boolean arguement

I am using Navigation component to launch & dismiss an ErrorDialog. I noticed that when I try to re-open the error dialog on a re-try flow I get an error that the action can't be found. It works the first time the dialog is launched. …