tezvyn:

How do you pass data between Fragments with Jetpack Navigation?

Source: developer.android.combeginner

Tests knowledge of modern, type-safe argument passing. A good answer defines the argument in the nav graph XML, uses the Safe Args plugin to generate Directions/Args classes, navigates with the action, and retrieves the data in the destination via `by…

This tests your knowledge of modern, type-safe argument passing in Android, specifically using the Jetpack Navigation component's tools. A great answer outlines four steps: define the `<argument>` in the navigation graph XML, use the Safe Args Gradle plugin to generate helper classes, pass data using the generated `NavDirections` object, and retrieve it in the destination with the `by navArgs()` delegate. A red flag is suggesting manual `Bundle` creation, which is not type-safe and misses the point of the library's tooling.

Read the original → developer.android.com

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

How do you pass data between Fragments with Jetpack Navigation? · Tezvyn