Navigation (Fragment & Compose)
UI › Material & Nav
Drills the Navigation component across Fragments and Compose: graphs, args, deep links, and back stack.
Navigation is a near-universal Android interview topic because it underpins single-activity architecture and screen-to-screen state. Interviewers test whether you understand NavController and the graph model, type-safe argument passing (Safe Args / @Serializable routes), deep links, and precise back stack control with popUpTo, launchSingleTop, and state saving. Strong candidates contrast the Fragment and Compose APIs and explain when each is appropriate.
What this covers
- NavController, NavGraph, NavHost/NavHostFragment, destinations and actions
- Passing arguments: Safe Args (XML/Fragments) vs type-safe @Serializable routes (Compose)
- Explicit vs implicit deep links and automatic back stack reconstruction
- Back stack control: popUpTo (inclusive), launchSingleTop, saveState/restoreState
- Single-activity architecture and graph-scoped ViewModels for sharing data
- Navigation in Compose: NavHost, composable destinations, nested graphs, toRoute()
Study this topic
- Navigation (Fragment & Compose) explained: the guided lesson
- 14 practice quiz questions
- 9 revision flashcards
- Navigation (Fragment & Compose) interview questions and answers