0Pricing
Jetpack Compose Academy · Lektion

Back Stack und Deep Links

Steuern Sie den Verlauf und öffnen Sie Routen aus URLs.

Back Stack und Deep Links ist eine kostenlose Jetpack Compose Academy-Lektion auf CoddyKit. Dies ist Lektion 4 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 Jetpack Compose Academy-Lernpfads, und dein Fortschritt wird über Web und CoddyKit-App synchronisiert. Der Jetpack Compose Academy-Kurs umfasst insgesamt 4 Lektionen.

Teile dieser Lektion wurden noch nicht übersetzt und werden auf Englisch angezeigt.

What the Back Stack Is

The back stack is the history of screens you have visited. Each navigate call pushes a new entry on top of it.

Going Back

Calling popBackStack() removes the top entry and shows the screen beneath. The system back gesture does the same thing automatically.

navController.popBackStack()

Pop Up To a Route

Use popUpTo while navigating to clear screens off the stack up to a target. It is perfect for returning to a known root.

navController.navigate("home") {
    popUpTo("home")
}

Avoid Duplicate Entries

Set launchSingleTop to true so tapping the same destination twice does not stack identical copies of it.

navController.navigate("home") {
    launchSingleTop = true
}

Clear After Login

After signing in, pop the login screen with inclusive = true so back never returns to it.

navController.navigate("home") {
    popUpTo("login") { inclusive = true }
}

Meet Deep Links

A deep link opens a specific screen directly from a URL or notification, skipping the normal step-by-step path through your app.

Declare a Deep Link

Attach a navDeepLink to a destination with a URI pattern. Compose matches incoming links against that pattern.

composable(
    "profile/{userId}",
    deepLinks = listOf(navDeepLink { uriPattern = "app://profile/{userId}" })
) { }

Deep Links Carry Arguments

Placeholders in a deep link URI fill your route arguments. Opening app://profile/42 lands on the profile screen with userId set to 42.

Register an Intent Filter

For links from outside the app, add a matching intent-filter in the manifest so Android routes the URL to your activity.

Deep Links Build the Stack

Navigation Compose can synthesize a back stack for a deep link, so pressing back walks up to a sensible parent instead of exiting.

Observe the Current Entry

Collect currentBackStackEntryAsState to react to where the user is, useful for highlighting a selected tab.

val entry by navController.currentBackStackEntryAsState()
val route = entry?.destination?.route

Quick Check

How do you stop back from returning to the login screen?

Recap

You now control history with popUpTo and launchSingleTop, and you can jump straight to a screen using deep links that even rebuild a sensible back stack. 🚀

Häufig gestellte Fragen

Ist die Lektion „Back Stack und Deep Links“ kostenlos?

Ja — der vollständige Text von „Back Stack und Deep Links“ ist hier im Web kostenlos zu lesen. Um sie interaktiv zu üben (integrierter Code-Editor und 24/7 KI-Tutor) und den Rest des Jetpack Compose Academy-Kurses freizuschalten, upgrade auf CoddyKit PRO. Der Jetpack Compose Academy-Kurs umfasst insgesamt 4 Lektionen.

Was lerne ich in „Back Stack und Deep Links“?

Steuern Sie den Verlauf und öffnen Sie Routen aus URLs. Du übst Jetpack Compose 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 Jetpack Compose Academy zu starten?

Keine Vorkenntnisse erforderlich. Jetpack Compose 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 4 von 4.

Wie lange dauert die Lektion „Back Stack und Deep Links“?

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 Jetpack Compose Academy-Lektion Code schreiben und ausführen?

Ja. Jede Jetpack Compose 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

  1. NavController und NavHost
  2. Composable-Ziele und Routen
  3. Argumente zwischen Bildschirmen übergeben
  4. Back Stack und Deep Links
← Zurück zu Jetpack Compose Academy