View pager first and second fragment data is not updating when data changed in android?

后端 未结 2 909
天命终不由人
天命终不由人 2020-12-12 04:03

i am using view pager (dynamic) for showing data from service. It is working fine but whenever i called the service again, the data in the view pager need to refresh and upd

相关标签:
2条回答
  • 2020-12-12 04:50

    The view/fragment in focus might not be updating when adapter refreshes. Try this:

    int currentPstn = lv_browseplans.getCurrentItem();
    
    lv_browseplans.setAdapter(browsePlansAdapter);
    
    lv_browseplans.setCurrentItem(currentPstn);
    
    0 讨论(0)
  • 2020-12-12 04:51

    Just changed to FragmentStatePagerAdapter instead of FragmentPagerAdapter in SectionsPagerAdapter class

    It is working now.

    0 讨论(0)
提交回复
热议问题