Member-only story
Android Compose: App Navigation how to Pass Data Between Screens
Compose series
Part 1: Compose Basics (WIP)
Part 2: Android Compose: App Navigation
Part 3: Android Compose: App Navigation how to Pass Data Between Screens
Part 4: Android Compose: Building a Simple Image Loading App with MVVM
Part 5: Android Compose: Building a Modern Android App with MVVM, Navigation, and Retrofit
This tutorial shows how to pass data between two screen. Continuation of the blog post: Android app Navigation with Compose — part 1 This code is a Jetpack Compose application with a simple navigation structure that demonstrates how to pass data between screens. Here’s an overview:
Code Execution Flow
App Launch:
MainActivity
initializes and loads theComposeNavigationApp
Composable.
Home Screen:
- The user sees the Home Screen with a text field and a button.
- They enter their name and click “Go to Details.”
Navigation to Details Screen:
- The
navController
navigates to the "details/{name}" route, passing the entered name as an argument.
Details Screen:
- The
name
argument is retrieved and displayed as part of a welcome message. - The user can click “Go to Home” to navigate back to…