Argumente und Deep Links übergeben
Daten sicher zwischen Zielen übertragen
Argumente und Deep Links übergeben ist eine kostenlose Kotlin Multiplatform Academy-Lektion auf CoddyKit. Dies ist Lektion 2 von 4. Du kannst die komplette Lektion unten kostenlos lesen – dann übst du sie direkt im Browser mit einem integrierten Code-Editor und einem KI-Tutor rund um die Uhr. Sie ist Teil des Kotlin Multiplatform Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Kotlin Multiplatform Academy-Kurs umfasst insgesamt 4 Lektionen.
Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.
Screens Need Data
A details screen has to know which item to show. Arguments are how one screen tells the next exactly what to display. 📦
Put the Value in the Route
You declare a placeholder right inside the route string. Curly braces mark where a value will be slotted in.
composable("details/{itemId}") { entry ->
DetailsScreen(entry)
}Read the Argument
Inside the destination you pull the value from the back stack entry. It arrives as a string you can use right away.
val itemId = entry.arguments?.getString("itemId")Pass a Value When Navigating
To send data you simply build the real route with your value inside it, then navigate to that string.
navController.navigate("details/42")Type-Safe Arguments
You can declare an argument as an Int instead of a string, so the framework parses and validates it for you.
composable(
"details/{itemId}",
arguments = listOf(navArgument("itemId") { type = NavType.IntType })
) { /* ... */ }Optional Query Arguments
Some values are optional, like a search filter. You add them as query parameters after a question mark in the route.
navController.navigate("search?query=kotlin")What Is a Deep Link
A deep link is a URL that opens a specific screen directly, even from outside the app. It maps a link to a route.
Register a Deep Link
You attach a deepLink pattern to a destination. When that URL arrives, navigation jumps straight to this screen.
composable(
"details/{itemId}",
deepLinks = listOf(navDeepLink { uriPattern = "myapp://details/{itemId}" })
) { /* ... */ }Deep Links Carry Arguments Too
The same placeholders work in a deep link URL. The itemId from the link lands in your back stack entry like any argument.
Platforms Wire Links Differently
Android and iOS each register your URL scheme in their own config, but both then hand the link to the shared graph. 🔗
Keep Arguments Small
Pass an id, not a whole object. Let the destination load its own data from the id, so routes stay tiny and reliable.
Quick Check
How should you typically send a complex object to the next screen?
Recap: Data and Direct Links
You sent arguments through routes, read them on the next screen, and mapped a deep link URL straight to a destination. 🎯
Häufig gestellte Fragen
Ist die Lektion „Argumente und Deep Links übergeben“ kostenlos?
Ja — der vollständige Text von „Argumente und Deep Links übergeben“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Kotlin Multiplatform Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Kotlin Multiplatform Academy-Kurs umfasst insgesamt 4 Lektionen.
Was lerne ich in „Argumente und Deep Links übergeben“?
Daten sicher zwischen Zielen übertragen Du übst Kotlin Multiplatform Academy mit praktischem Code, den du direkt im Browser ausführst, und ein 24/7 KI-Tutor beantwortet deine Fragen während du die Lektion bearbeitest.
Brauche ich Erfahrung, um Kotlin Multiplatform Academy zu starten?
Keine Vorkenntnisse erforderlich. Kotlin Multiplatform Academy auf CoddyKit ist für Anfänger bis fortgeschrittene Lernende strukturiert, sodass du hier starten oder von Anfang an beginnen und in deinem eigenen Tempo voranschreiten kannst. Dies ist Lektion 2 von 4.
Wie lange dauert die Lektion „Argumente und Deep Links übergeben“?
Die meisten CoddyKit-Lektionen dauern etwa 5–10 Minuten. Jede ist kompakt und interaktiv, sodass du stetig Fortschritte machst und genau dort weitermachst, wo du aufgehört hast – im Web und in der App.
Kann ich in dieser Kotlin Multiplatform Academy-Lektion Code schreiben und ausführen?
Ja. Jede Kotlin Multiplatform Academy-Lektion enthält einen integrierten Code-Editor, sodass du echten Code direkt in deinem Browser schreibst und ausführst und sofort KI-Feedback erhältst — ohne lokale Einrichtung erforderlich.
Alle Lektionen in diesem Kurs
- Zwischen gemeinsamen Screens navigieren
- Argumente und Deep Links übergeben
- Gemeinsame Bilder, Fonts und Strings
- Gemeinsame UI-Texte lokalisieren