Update data in ListFragment as part of ViewPager

后端 未结 10 1867
一整个雨季
一整个雨季 2020-11-22 07:55

I\'m using the v4 compatibility ViewPager in Android. My FragmentActivity has a bunch of data which is to be displayed in different ways on different pages in my ViewPager.

10条回答
  •  悲哀的现实
    2020-11-22 08:29

    This is my solution since I don't need to keep track of my tabs and need to refresh them all anyway.

        Bundle b = new Bundle();
        b.putInt(Constants.SharedPreferenceKeys.NUM_QUERY_DAYS,numQueryDays);
        for(android.support.v4.app.Fragment f:getSupportFragmentManager().getFragments()){
            if(f instanceof HomeTermFragment){
                ((HomeTermFragment) f).restartLoader(b);
            }
        }
    

提交回复
热议问题