Skip to content

simple implementation of Dagger subcomponents, connecting the ApplicationComponent to the ActivityComponent. Also uses viewmodel with ViewModelFactoy and Retrofit

License

Notifications You must be signed in to change notification settings

10XMairing/DaggerSubComponentsExample

Repository files navigation

Dagger 2 with components and sub-components

  • Connecting your Application compoenent with your MainComponent making the application level dependencies in this case the Retrofit's ApiService to the Activity Level Module.

  • The ApiService collected from the ApplicationComponent is passed on to the constructor of ViewModel using ViewModelFactory

  • The data is loaded in the ViewModel (MainViewModel) RIght now only the response is logged.

All of this can be achieved in a better format using Android-dagger helper classes.

Dagger-android-example

References OFFICIAL DOCS

About

simple implementation of Dagger subcomponents, connecting the ApplicationComponent to the ActivityComponent. Also uses viewmodel with ViewModelFactoy and Retrofit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages