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

Unlock the full course today

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

Building the graph with @Inject and @Component

Building the graph with @Inject and @Component

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

Start my 1-month free trial

Building the graph with @Inject and @Component

- [Instructor] Now that you've added Dagger to your application we can begin to write code using it. Remember that Dagger is a compiler extension. Using it is different than using most other third-party libraries. Just how do you use Dagger in an application? To understand that, let's have one more look at the dependency injection code from the last video. In the last videos, I demonstrated dependency injection by creating a series of Factories. I then showed an Activity using one of those Factories to create the object that it needed, along with all of the necessary dependencies. Let's walk through the chain of events that actually takes place when the Activity calls the get method on the MainPresenterFactory. The MainPresenterFactory's get method immediately calls the NetworkClientFactory's get method. That in turn, calls the NetworkConnectionFactory's get method. The NetworkConnectionFactory's get method calls the EndPointFactory's get method. And finally, the EndPointFactory's get…

Contents