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

前端 未结 5 1153
既然无缘
既然无缘 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:12

    Sorry for big delay, but I think that someone will found this info useful. I found a way to get all ReviewItems since you can have a lot of branches and you won't be able to use the first answer.

    I'm pretty sure, that your mPagerAdapter::getItem code looked like in example (so it just returned new fragment, instead of returning current pager fragment). You have to use instantiateItem to get reference on your ReviewFragment.

    Object o = mPager.getAdapter().instantiateItem(mPager, mPager.getCurrentItem());
    if(o instanceof ReviewFragment) {
      List items = ((ReviewFragment) o).getCurrentReviewItems();
      if(items != null) {
        Log.v(TAG, "Items are: " + items.toString());
      }
    }
    

提交回复
热议问题