Using Dagger2 to Keep Android SDK Dependencies Clean
summary
Practical guide to using Dagger 2 to move Android SDK dependencies (Context, FragmentManager, Intents, transitions) out of app logic into the dependency-injection graph in an MVVM + DataBinding app. Covers splitting scopes into Singleton and Lifecycle, creating per-screen subcomponents, two patterns for providing/detaching Context, delegate vs instanceof selection for FragmentManager, an Intent-builder + TransitionHandler pattern, and lifecycle handling via Architecture Components or a custom callback controller.
AI-written summary · about
chapters (7)
- 0:00Dagger2 for Android
- 2:58Why use Dagger2
- 4:24Scope annotations
- 12:47Separating context deps
- 15:47Screen transitions
- 19:52Activity/fragment callbacks
- 25:37Best practices
related talks
45mDagger 2 - Back to Basics
38mDagger 2, 2 Years Later
22mDependency Injection in Android using Dagger 2
29mForging the Dagger for the modern Android world
25mDagger 2 Android : Defeat the Dahaka
41mA (K)night with Dagger - Slicing problems of newbies
30mPowering up Dagger for Less Code and Cleaner Architecture
42mDependency injection made simple
