Questions tagged [jetpack-compose-navigation]

200 questions
4
votes
1 answer

How to handle Android Compose BottomBar Navigation mixed with arguments

I have an Android app using compose navigation. Navigating between its three screens - Home, Calendar, More - is done via a bottom bar: // onBottomBarItemClick from https://developer.android.com/jetpack/compose/navigation#bottom-nav:…
m.reiter
  • 1,796
  • 2
  • 11
  • 31
4
votes
1 answer

Jetpack Compose Navigation endless loop

I am trying to show a walkthrough of my app on initial start up. I am trying to present 3 screens Welcome Screen1 Screen2 I have this navigation graph composable(Routes.Welcome.name) { WelcomeScreen( done = { …
4
votes
1 answer

ViewModel triggered navigation with JetpackCompose

In Android I often want to navigate is response to state change from a ViewModel. (for example, successful authentication triggers navigation to the user's home screen.) Is the best practice to trigger navigation from within the ViewModel? Is…
4
votes
0 answers

Jetpack Compose - How to Identify user is coming via back navigation

I come across requirement where I have to do certain task when user is coming via back navigation flow. Suppose : Currently user is on A Screen and on button click it got navigated to B Screen. On B Screen I'm using BackHandler to navigate user to…
4
votes
1 answer

Is it possible you can get the actual value of a string resource by calling it from a sealed class?

I want to add a string resource to my app in the topbar but when I call it a number appears and because it is a sealed class it does not let me implement stringResource or getString. AppEsquema
4
votes
1 answer

Jetpack Compose Navigation loads screen infinitely

I am trying to implement Navigation using single activity and multiple Composable Screens. This is my NavHost: @Composable @ExperimentalFoundationApi fun MyNavHost( modifier: Modifier = Modifier, navController: NavHostController =…
4
votes
1 answer

How to integrate AlertDialog with Navigation component in Jetpack Compose?

I am using Jetpack Compose and the Android navigation component. When I am on a screen with an AlertDialog, I am unable to navigate back. I guess it's due to the AlertDialog catching the back button event. However I don't know how to connect the…
4
votes
1 answer

How many ViewModels would one use with Jetpack Compose navigation component?

When using Jetpack Compose navigation, would one use one ViewModel for all screens or one ViewModel for each screen? Is there any architecture guidance on this? And if one would use multiple ViewModels, where would one instantiate them?
4
votes
0 answers

How to send consumable events through jetpack compose navigation

is there any possibility to sent over a consumable one-time event when navigating to another (unrelated and therefore not sharing the same viewmodel) screen in jetpack compose navigation? When handing over an argument via navigation, this value is…
4
votes
1 answer

Android ViewModel onCleared() called too late

From my understanding of navigation graph scoped view models, their onCleared method should get called immediately when the associated navigation graph is popped from the navigation stack. What I'm seeing is that it takes a couple more navigate…
4
votes
1 answer

Navigate to another screen without the previous scaffold in Jetpack Compose

My app has a main screen with a Scaffold and a BottomNavigation bar: override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { val navController = rememberNavController() …
4
votes
0 answers

Compose navigation destination is not a direct child of this NavGraph When Start destination having args

I want to call this Compose as startDestination with arguments. I'm getting the below exception, but if i call this in another compose work as expected. java.lang.IllegalArgumentException: navigation destination xxx is not a direct child of this…
4
votes
1 answer

How to overcome this build error when trying to run jetpack compose instrumentation tests

I've followed the jetpack compose navigation codelab. Everything was going well until it came to testing the NavHost in step 7. When trying to run the tests, I get the following error and stack trace : FAILURE: Build failed with an exception. *…
4
votes
0 answers

Jetpack Compose interoperability - keep view instance

I am developing an app with Jetpack Compose. In my project, I have to add a custom map view that uses a GLSurfaceView. When creating that view, it takes some time to initialize everything. Now when I navigate to another screen and back to the map…
4
votes
1 answer

how to remove the a composable from the back stack in Compose-Navigation

I there is a a screen in my application that allows the user to Edit an Item in the database and after the user finishes editing the item they click on "Done" Button that will take them to the previous Screen. But when the user click on the back…
1 2
3
13 14