Jetpack Navigation: Getting Started

Aug 10 2021 · Kotlin 1.4, Android 11, Android Studio 4.2.1

Part 2: Create Destinations & Navigate via Actions

07. Pass Data Between Destinations

Episode complete

Play next episode

Next
About this episode
Leave a rating/review
See forum comments
Cinema mode Mark complete Download course materials
Previous episode: 06. Add Destinations & Navigate via Action Next episode: 08. Animate Transitions Between Destinations

Heads up... You've reached locked video content where the transcript will be shown as obfuscated text.

In Add Dependecies Episode, you added Safe Args Gradle Plugin. Safe Args is strongly recommended for navigating and passing data, because it ensures type-safety.

 v ->
  val action = LoginFragmentDirections.actionWelcomeFromLogin(user, getString(R.string
      .action_logged_in))
  v.findNavController().navigate(action)
v ->
  val action = SignUpFragmentDirections.actionWelcomeFromSignUp(user, getString(R.string
      .action_signed_up))
  v.findNavController().navigate(action)
arguments?.let {
  val safeArgs = WelcomeFragmentArgs.fromBundle(it)
  param1 = safeArgs.param1
  param2 = safeArgs.param2
}