0
は私がモデルmouduleを作成MVP + dagger2
モデルをPresenterに挿入するにはどうすればいいですか?
を作成してみてください:
@Module
class ModelsModule {
@Provides
BasketModel provideBasketModel() {
return new BasketModel();
}
@Provides
ProductModel provideProductModel() {
return new ProductModel();
}
}
と私はプレゼンターを作成する必要があります。私のプレゼンターは、モデルに
プレゼンターを使用する必要があります。
public class ProductPresenter {
private ProductModel;
public ProductPresenter(ProductModel productModel) {
this.productModel = productModel;
}
publict void test(){
productModel.someMethod();
}
とプレゼンターを作成するとき、私はProductModelを設定することはできません。私はこのように作成プレゼンター:
@Module
public class PresentersModule {
@Provides
ProductPresenter provideProductPresenter() {
return new ProductPresenter();//What I need set to constructor? new ProductModel()?
}
コンポーネントはどこにありますか?どのようにコンポーネントを構築していますか? – azizbekian