From the course: Android Dependency Injection with Dagger 2 and Kotlin

Unlock the full course today

Join today to access over 22,500 courses taught by industry experts or purchase this course individually.

@Subcomponents review

@Subcomponents review

From the course: Android Dependency Injection with Dagger 2 and Kotlin

Start my 1-month free trial

@Subcomponents review

- [Instructor] In the last video we created a subcomponent. We've really kind of wandered into Dagger's uncanny valley here though. What we've got are automatically created factories that depend on other automatically created factories that use builders to assemble modules that are also automatically created. Good grief. Let's go over this one more time. Here's the code that injects the presenter into the main activity. We've seen that inject method out there on the right before. We should be pretty comfortable with that part. But what's this App.rootFactory? Well, App.rootFactory is an instance of our new root factory. Think of this as sort of a application level factory whose main job is to provide other factories. So where does the root factory come from? Here's the definition of the root factory. In a bigger, more complicated application, the root factory might hold lots of information that was global to the app. It might also provide lots of smaller factories. In this tiny…

Contents