Roman Nurik's Wizard pager - how to access collected data?

前端 未结 5 1162
既然无缘
既然无缘 2021-02-09 06:56

I am trying to make a wizard using Roman Nurik\'s library (https://plus.google.com/113735310430199015092/posts/6cVymZvn3f4).

I am having trouble accessing the collected

5条回答
  •  礼貌的吻别
    2021-02-09 07:09

    Inside if (mPager.getCurrentItem() == mCurrentPageSequence.size()) { }

    For single page variable:

    String data = mWizardModel.findByKey("Sandwich:Bread").getData().getString(Page.SIMPLE_DATA_KEY);
    

    For customized page:

    String data = 
    mWizardModel.findByKey(THE_KEY).getData().getString(CustomerInfoPage.YOUR_DATA_KEY);
    

    If you want to assign the data back to the wizard, put this at the end of onCreate in FragmentActivity:

    Bundle data = new Bundle();
    if (!TextUtils.isEmpty(DATA_STRING)) {
        data.putString(Page.SIMPLE_DATA_KEY, DATA_STRING);
        mWizardModel.findByKey("Sandwich:Bread"").resetData(data);
    }
    

    The key "Sandwich:Bread" is from the example, change whatever suit you. Never try the multi one, I think it is more or less the same.

提交回复
热议问题