Questions tagged [jetpack-compose-navigation]
200 questions
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
27
votes
6 answers
How to pass object in navigation in jetpack compose?
From the documentation, I can pass string, integer etc. But how can I pass objects on navigation?
Note: If I set the argument type parcelable then the app crashes with java.lang.UnsupportedOperationException: Parcelables don't support default…

Mahmudul Hasan Shohag
- 2,203
- 1
- 22
- 30
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
16
votes
6 answers
JetpackCompose Navigation Nested Graphs cause "ViewModelStore should be set before setGraph call" exception
I am trying to apply Jetpack Compose navigation into my application.
My Screens: Login/Register screens and Bottom navbar screens(call, chat, settings).
I already found out that the best way to do this is using nested graphs.
But I keep getting…

talhaoz
- 259
- 3
- 11
16
votes
3 answers
How to share a viewmodel between two or more Jetpack composables inside a Compose NavGraph?
Consider this example.
For authentication, we'll be using 2 screens - one screen to enter phone number and the other to enter OTP.
Both these screens were made in Jetpack Compose and the for the NavGraph, we are using compose navigation.
Also I have…

Gideon Paul
- 348
- 1
- 4
- 11
13
votes
2 answers
Jetpack Compose: Nested navigation with bottom bar navigation in a nested route
My app has the following structure and because Route B has a own bottom navigation bar and thus an own NavHost, how can I navigate from Screen C (opened from the tab bar) to Route A?
- Nested Route "/onboarding_route", startDestination = 'start'
…

xshake
- 345
- 3
- 12
13
votes
4 answers
Navigation destination that matches request NavDeepLinkRequest cannot be found in the navigation graph NavGraph
I have a NavGraph that looks like this:
@Composable
fun NavGraph (
navController: NavHostController
) {
NavHost(
navController = navController,
startDestination = "Products"
) {
composable(
route =…

Joan P.
- 2,368
- 6
- 30
- 63
13
votes
4 answers
How to handle back navigation with Jetpack Compose + Navigation (without fragments)
I am trying to navigate lets say from onboarding to dashboard and beyond and pop the onboarding once user hits dashboard, but still with 'back action' I end up on onboarding again.
Here is the sample code:
@AndroidEntryPoint
class MainActivity :…

ThinkDeep
- 519
- 1
- 4
- 19
12
votes
2 answers
How to navigate to a non bottom bar screen with jetpack compose?
So i have an app in compose that has startDestination set as a screen with scaffold with bottom nav bar having 3 items and top app bar, i am able to navigate through the 3 bottom navigation tabs. But suppose i want to click on a card in one of the…

ishubhamsingh
- 121
- 5
8
votes
3 answers
Compose Navigation : Passing Arguments in Back Stack
I have tried all possible way looks like not getting a solution to this.
I am using an all compose app with compose screens and using compose navigation to navigate between this screen, I have a scenario where I am navigating further in this…

Cyph3rCod3r
- 1,978
- 23
- 33
8
votes
1 answer
Manually pre-populate navigation backstack in Android/Jetpack Compose
Is it possible to pre-populate the navigation backstack in Android/Jetpack Compose?
I have a deeplink, that navigates deep into the navigation hierarchy, however, on back press, it navigates to the root route.
Example:
Route.Main -> Route.List ->…

Johnneh
- 247
- 1
- 10
8
votes
3 answers
Pass an argument to a nested navigation graph in Jetpack Compose
From the docs, I see you can nest navigation graphs like so:
NavHost(navController, startDestination = "home") {
...
// Navigating to the graph via its route ('login') automatically
// navigates to the graph's start destination -…

Eric
- 543
- 7
- 17
7
votes
2 answers
Compose - NavHost recomposition multiple times
During navigation from Navhost, I found out that the composable screens are getting recomposition multiple times. Because of it, my ViewModel is calling API data source multiple times too.
@Composable
fun MainView() {
val scaffoldState =…

LMaker
- 1,444
- 3
- 25
- 38
7
votes
0 answers
Jetpack Compose Navigation:How to pass an array as an argument?
I have a filter dialog that shows filter options :
When I click on "Parent Platform" section I'm navigating to the PlatformsScreen with two arguments. Argument one is parent which is int and the second is platforms which is an array of int :
sealed…

Jarnojr
- 543
- 1
- 7
- 18
7
votes
2 answers
Jetpack compose navigation popUpTo inclusive true not cleared composable screen from backstack
I am using Jetpack Compose ui version 1.3.0-beta08 and navigation compose version 2.4.0-alpha02 and working Bloom app with all new Architecture components. After login success I need to clear all previous compose login screens, but even added…

Ramprasad
- 7,981
- 20
- 74
- 135