Navigation between different screens and apps is a core part of the user experience. Android Jetpack Navigation Component helps the developer to implement it following the good practices. For more info see documentation: https://developer.android.com/guide/navigation
Questions tagged [android-jetpack-navigation]
834 questions
22
votes
1 answer
Jetpack Compose NavHost recomposition composable multiple times
I found out that the composable screens are getting recomposition multiple times during navigation from Navhost compose
the following example shows how I'm integrating the navigation with logs to identify how many time the function is getting…

tamtom
- 2,474
- 1
- 20
- 33
22
votes
4 answers
NavController.OnDestinationChangedListener passes a destination.id not matching the triggered Navigation Action ID
In my Android project I have a very simple Navigation Graph, including two fragments: Master and Detail:

gary0707
- 313
- 1
- 3
- 10
21
votes
2 answers
How to use Hilt to inject a safe-args argument into a viewmodel?
I have found a similar question here. At the time of writing this question there is only this answer avaliable, which does not provide any help to me, and I believe also to the person who asked the question.
I checked the repo which is linked in the…

HelloThere
- 210
- 1
- 3
- 7
20
votes
2 answers
Pass arguments safely to nested graph with Navigation Component
I'm using Android Jetpack Navigation Component.
I have a nested nav graph with id, say R.id.nested_graph
The first Fragment of the nested graph receives one parameter.

GaRRaPeTa
- 5,459
- 4
- 37
- 61
20
votes
2 answers
android navigation component up button, arrow displays but popTo not working
I'm using the jetpack navigation component with a very simple set up, one activity (MainActivity) and 4 fragments
MainFragment,
CardPreviewFragment,
createCardFragment,
and AddPredictionChipsFragment,
The NavigationUI component sets up my nav…

martinseal1987
- 1,862
- 8
- 44
- 77
19
votes
8 answers
ViewPager2 crash
I am using Advance Navigation Component with BottomNavigationView.
In one tab I have ViewPager2. When I clicked on the tab for the first time, it worked fine.
Although the second time, come on that tab application keep crashing. Below is the crash…

patel dhaval r
- 1,237
- 1
- 8
- 17
18
votes
2 answers
Visual navigation graph representation in Jetpack Compose?
Jetpack navigation component has a nice visual representation of nav_graph.xml file between fragments, however if we use navigation component for Jetpack Compose there is no support nav_graph.xml for composable functions. Then the question is how…

Arsenius
- 4,972
- 4
- 26
- 39
18
votes
3 answers
Jetpack Compose: close application by button
NavController can't pop programmatically the latest @Composable in the stack. I.e. popBackStack() doesn't work if it's a root page. So the application can be closed by tap on "Close" button view and only hardware Back key allows to leave…

Sergey Krivenkov
- 579
- 1
- 6
- 14
18
votes
1 answer
android - Navigation graph Flow Preview in landscape
The navigation graph preview of Android jetpack components always shows a portrait view of screens for the screens in the layout editor. Can we customize this to view the screens on an emulator of our choice?

Saby
- 718
- 9
- 29
17
votes
3 answers
How pass parcelable argument with new version of compose navigation?
I had an app made with jetpack compose that worked fine until I upgraded the compose navigation library
from version 2.4.0-alpha07 to version 2.4.0-alpha08
In the alpha08 version it seems to me that the arguments attribute of the NavBackStackEntry…

Pierre Vieira
- 2,252
- 4
- 21
- 41
17
votes
0 answers
How to recreate singleTop behavior when using navigation component's deep links?
How to recreate singleTop behavior when using navigation component's deep links?
I'm using Jetpack Navigation and I'm currently trying to implement notification clicks. One of the fragments is used to play music. When you background the app, a…

Ziem
- 6,579
- 8
- 53
- 86
17
votes
4 answers
Display back button on toolbar on first screen of navigation graph
I'm trying out androidx navigation component and have setup my activity with a toolbar a container. I'm doing this in one of the intermittent screens of my app which has a lot of internal navigation/steps and I thought I could navigation arch…

Abhiroop
- 203
- 2
- 9
17
votes
2 answers
Android Navigation Component + Login Flow + Nested BottomNavigationView
I'm struggle building a Navigation, like on the image below, with the Android Navigation Component.
I need a "Login Flow", check if the user is logged in and then navigate to the main part of the app (also clearing the backstack). The main part…

D.Roters
- 221
- 2
- 6
17
votes
8 answers
How to handle back button when at the starting destination of the navigation component
I've started working with the new navigation component and I'm really digging it! I do have one issue though - How am I supposed to handle the back button when I'm at the starting destination of the graph?
This is the code I'm using…

MichaelThePotato
- 1,523
- 2
- 10
- 19
16
votes
1 answer
jetpack compose disable back button
how can i disable the back button in jetpack compose or don't want the user to go back to previous screen,
I tried below code but, still go back to previous screen
BackHandler(enabled = false) {
//do nothing
}

Sam
- 6,215
- 9
- 71
- 90