Look at your โAdapterโ, which implements the 'FragmentPagerAdapter', and something will contain a collection type field, such as an ArrayList that supports the adapter.
Depending on the implementation of dataStructure, you can change the base collection by calling the appropriate add, install, and paste methods in the fragmentpageradapter.
Then your next call to get a new page in ViewPager should reflect a change in the base collection. If this is not the case, you may have to call "commit" in the FragmentManager, but I don't think it is necessary in this case.
public class BookPagerAdapter extends FragmentPagerAdapter {private int currentPage = 0; private ArrayList mFragments;
public BookPagerAdapter(FragmentManager fm) { super(fm); mFragments = new ArrayList<Fragment>(); mFragments.add(new PageFragment(BitmapFactory.decodeResource(getResources(), R.drawable.icon_construction32), "TitlePage")); }
collection change example:
bpa.mFragments.add(new PageFragment(map));
source share