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
224
votes
40 answers
IllegalArgumentException: navigation destination xxx is unknown to this NavController
I am having an issue with the new Android Navigation Architecture component when I try to navigate from one Fragment to another, I get this weird error:
java.lang.IllegalArgumentException: navigation destination XXX
is unknown to this…

Jerry Okafor
- 3,710
- 3
- 17
- 26
120
votes
10 answers
Fragments destroyed / recreated with Jetpack's Android Navigation components
I'm trying to implement Navigation with Jetpack's architecture components in my existing app.
I have a single activity app where the main fragment (ListFragment) is a list of items. Currently, when the user taps on a list item a second fragment is…

pauminku
- 3,526
- 3
- 22
- 24
55
votes
9 answers
Compose-Navigation: Remove previous composable from stack before navigating
I'm using compose-navigation(alpha09) to handle the navigation between composables
I want to remove the Splash screen when moving to the next destination (I don't want the back pressed to get back to Splash)
Following attempts did not work as…

Mahdi-Malv
- 16,677
- 10
- 70
- 117
54
votes
7 answers
Android studio build error in navigation component, action is not abstract and does not implement abstract member actionID
Out of nowhere, the build is crashing with a strange error related to the navigation component even though it used to work before, the error is in the generated class, in my case NativeLanguageSelectionFragmentDirections
Here is the error
e:…

David Ibrahim
- 2,777
- 4
- 17
- 41
48
votes
17 answers
Pass Parcelable argument with compose navigation
I want to pass a parcelable object (BluetoothDevice) to a composable using compose navigation.
Passing primitive types is easy:
composable(
"profile/{userId}",
arguments = listOf(navArgument("userId") { type = NavType.StringType })
)…

Noah
- 2,718
- 3
- 17
- 23
45
votes
13 answers
CreationExtras must have a value by `SAVED_STATE_REGISTRY_OWNER_KEY`
I'm trying to implement navigation in my app which is built with Jetpack Compose, but when I try to navigate from a screen to another I get:
java.lang.IllegalArgumentException: CreationExtras must have a value by SAVED_STATE_REGISTRY_OWNER_KEY
I'm…

Joan P.
- 2,368
- 6
- 30
- 63
36
votes
3 answers
How to navigate from a composable to an activity or a fragment in Jetpack Compose?
What are the ways in which navigation is possible between a composable and an Activity and vice versa?
Can I do it by using StartActivity(..) method or the only way is to create Screens and NavController?

Sweta Jain
- 3,248
- 6
- 30
- 50
33
votes
5 answers
Sharing viewModel within Jetpack Compose Navigation
Can anyone suggest how to share a ViewModel within different sections of a Jetpack Compose Navigation?
According to the documentation, viewModels should normally be shared within different compose functions using the activity scope, but not if…

Hasan
- 589
- 2
- 6
- 11
33
votes
9 answers
Jetpack Compose navigate for result
I'm using the Jetpack Navigation library with the Compose version. I'm setting up navigation like it's shown here
I want to be able to navigate from screen A to screen B. Once B does something and pops off the back stack, it will then return a…

Elforama
- 512
- 1
- 4
- 16
30
votes
4 answers
Scoping a viewmodel to multiple fragments (not activity) using the navigation component
I'm using the navigation component, I want a view model to be shared between a few fragments but they should be cleared when I leave the fragments (hence not scoping them to the activity) I'm trying to take the one activity many fragments approach.…

martinseal1987
- 1,862
- 8
- 44
- 77
29
votes
5 answers
hide Top and Bottom Navigator on a specific screen inside Scaffold Jetpack Compose
I'm creating a simple app with bottom navigation and drawer.
I wrap all screens inside a Scaffold with topbar and bottom bar.
I want to hide top bar and bottom bar on a specific screen. Does anyone know to how achieve that
here is the code for…

cuongtd
- 2,862
- 3
- 19
- 37
29
votes
2 answers
Multiple arguments with jetpack compose navigation
How do I declare a navigation route with multiple navigation arguments? I've checked the documentation, and all of these articles (which seem to simply reiterate what the documentation says), and I could only find examples of routes with one…

Noah
- 2,718
- 3
- 17
- 23
25
votes
4 answers
Jetpack Compose Navigation - pass argument to startDestination
The app I'm building uses compose navigation with routes. The challenge is that the start destination is dynamic.
Here is a minimal example:
class MainActivity : ComponentActivity()
{
override fun onCreate(savedInstanceState: Bundle?)
{
…

Peter F
- 3,633
- 3
- 33
- 45
23
votes
2 answers
Android Navigation Component: Start at a different destination than home, programmatically?
I'm trying to implement a multiple navigation controller with multiple back stack BottomNavigationView, as per the github examples. However, the example uses a different nav graph for each tab, which makes things easy. In my case I need to use the…

Lucas P.
- 4,282
- 4
- 29
- 50
23
votes
6 answers
Fragment XXX {} not associated with a fragment manager
I started using navigation component in my application and I am facing with the following problem.
My first fragment is LoginFragment. After a success login, the mainFragment is displayed. I want that when user is on mainFragment and press back…

Gabrielle
- 4,933
- 13
- 62
- 122