I\'m playing with Dagger-2 to figure how to integrate it in our existing application and I\'m facing something which I can\'t understand or I\'m doing wrong.
My situatio
Ah...I share your pain. You can't inject two components into same Activity. At least I was not able to find how! :)
That was logical for me to try, as well, and I faced same problems.
You can resolve it with 2 approach:
So, instead of
@Singleton
@Component(modules = {RestModule.class, SocketModule.class})
public interface NetComponent {
void inject(MainActivity activity);
}
try with
@Singleton
@Component(modules = {RestModule.class, SocketModule.class, DbModule.class})
public interface SecondActivityComponent {
void inject(SecondActivity activity);
}
I found second one as cleanest solution.
If anybody has some other advice, I am ready to try it!