Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Navigation in Jetpack Compose

Navigation in Jetpack Compose

Learn about navigation in Jetpack Compose using the Jetpack navigation library, and best practices when implementing navigation on your app.

Happy Composing! 🥳

Beatrice Kinya

June 16, 2023

More Decks by Beatrice Kinya

Other Decks in Programming


  1. Navigation Components - NavHost: A container where destinations are swapped

    in and out as a user navigates through your app. - NavController: Manages app navigation within a NavHost - Stateful - Keeps track of the back stack composables - Navigation destination: Composable screens.
  2. Passing Arguments between Destinations - You add argument placeholders to

    your route. - By default, all arguments are parsed as Strings. - You can create a NamedNavArgument using navArgument() method and specify the type. arguments = listOf(navArgument("itemId") { type = NavType.IntType }) - You retrieve the argument from NavBackStackEntry available in the lamda of the composable() function.