| Start |
|---|
Create @Module Class and @Singleton annotation for Object Every provider (or method) must have the |
| Request Dependencies in Dependent Objects Now that you have the providers for your different models, you need to request them. Just as You can use the |
| Connecting @Modules with @Inject The connection between the provider of dependencies, For the |
| Using @Component Interface to Obtain Objects Now that you have every connection ready, you have to obtain an instance of this interface and invoke its methods to obtain the object you need: When you try to create a new object of the interface with the Remarks
Dagger 2 API:Dagger 2 exposes a number of special annotations: @Module for the classes whose methods provide dependencies @Provides for the methods within @Module classes @Inject to request a dependency (a constructor, a field, or a method) @Component is a bridge interface between modules and injection Important Links:GitHub: https://github.com/google/dagger (opens new window) UserGuide(Google): https://google.github.io/dagger/users-guide.html (opens new window) Videos: https://google.github.io/dagger/resources.html (opens new window) Vogella Tutorial: http://www.vogella.com/tutorials/Dagger/article.html (opens new window) Codepath Tutorial: https://github.com/codepath/android_guides/wiki/Dependency-Injection-with-Dagger-2 (opens new window) |
Read Article
https://develop.horje.com/learn/1434/reference