Dagger2无法保存字段?

时间:2016-08-17 05:41:50

标签: android mvp dagger

我在我的项目中使用MVP + Dagge2。该项目有一个PaymentPresenter,    当PaymentActivity调用PaymentPresenter的方法paymentsSize()时,    然后它返回0我确定支付大小是1,因为我调用了addPaymentToPayments方法并且已经输出到logcat。

 mPayments:[Payment{name='储值卡', data='8.00', bh=1, id='2'}]
抱歉,如果我的问题不清楚,请告诉我。

PaymentComponent:

@ActivityScope
@Component(dependencies = AppComponent.class, modules = {PaymentModule.class})
public interface PaymentComponent {

   void inject(PaymentActivity activity);

}

PaymentModule:

    @Module
    public class PaymentModule {

    private final PaymentContract.View mView;
    private final Intent mIntent;


    public PaymentModule(PaymentContract.View view, Intent intent){
        mView = view;
        this.mIntent = intent;
    }

    @Provides
    PaymentContract.View providePaymentContractView(){
        return mView;
    }

    @Provides
    Intent provideIntent(){
        return mIntent;
    }

}

0 个答案:

没有答案