https://kotlinlang.org logo
#compose
Title
# compose
j

Justin Tarnoff

01/19/2023, 1:00 AM
Is there a way to navigate to an activity using Jetpack Compose Navigation and pass a parameter (an Int in my case)? I can add an activity to the NavGraphBuilder using the
activity(route, ActivityNavigationDestinationBuilder)
extension, but I don't see a good way to add a bundle (or any data) that will get attached to the Activity when it's started.
i

Ian Lake

01/19/2023, 1:15 AM
Just like any other destination, the arguments are part of the route
j

Justin Tarnoff

01/19/2023, 1:26 AM
On the composable extension, there is an
arguments
parameter than you can use to decode the arguments that are included as part of the route. The activity extension doesn't have an arguments parameter to do the same thing.
j

Justin Tarnoff

01/19/2023, 1:34 AM
OK, I didn't see the arguments in the signature for
activity()
, but in the link you provided, I see the Kotlin DSL function to add arguments that I couldn't find before. Thank you for the timely answers!
77 Views