Single activity: Why, when, and how
summary
Argues that apps benefit from a single-activity architecture using the Navigation Architecture Component to get predictable deep links, shared-scoped view models, and simpler testing. Demonstrates concrete tools: NavController, NavHostFragment, the Safe Args Gradle plugin, FragmentFactory and the new Fragment 1.1 alpha with FragmentScenario (works on device and Robolectric) and ActivityScenario. Warns when multiple activities are still appropriate (multiple tasks, picture-in-picture) and cites a surprising 77-comment debate from 2016 about the idea.
AI-written summary · about
chapters (8)
- 0:00The role of activities
- 2:07Limitations of activities
- 5:44Moving to single activity
- 9:02Navigation component
- 13:28Testing with fragments
- 20:51Dependency injection
- 25:38Managing tasks and windows
- 34:28Dynamic features and conclusion
related talks
37mSingle Activity by Example
36mNavigation and the Single Activity: Learnings from a Skeptic
46mModern Android: How to ditch Activities and Fragments
38mMigrating to a Single-Activity Architecture in a Modular App
26mSingle activity navigation so simple even I can understand it
42mRoad to Single Activity
53mSimplified Single-Activity Apps Using Simple-Stack
36mAdventures in Navigation
