https://kotlinlang.org logo
y

yousuf.haque

10/09/2017, 2:46 PM
@nickk use dagger 2 modules to inject state into your dagger components, such as your activity. Here’s a great article about it, but this specifically refers to a user module. Instead of having a user module, where you pass in a user into the constructor, create a MyActivityModule, and pass in the activity instance into the constructor of the module when creating your dagger 2 component. Make sure to release (null out) the component that contains that module on configuration change so the old instance of your activity isn’t retained by the module/component http://frogermcs.github.io/dependency-injection-with-dagger-2-custom-scopes/