Closed ysmintor closed 7 years ago
Also I want to ask about the how to Inject specific Retrofit2
like a different base url in that Activity to provide, So How could Dagger2 solve this problem?
@ysmintor When you inject into your activity, your activity will be attached to your dagger graph. Then you can provide your mainView with your activity. Actually, It is already defined in MainActivityModule
@iammert After a while I saw the code in MainPresenterImpl.
@Inject
public MainPresenterImpl(MainView mainView, ApiService apiService) {
this.mainView = mainView;
this.apiService = apiService;
}
So for the mainView, I have to add a MainViewImpl
and add @Inject above its contructor to let Dagger2 inject?
Yes. I suggest you read https://google.github.io/dagger/ .
I don't find any Inject of mainView, Where could Dagger2 to find it and then to provide MainPresenter?