android - Dynamically adding/removing pages from FragmentStatePagerAdapter -
i looking @ example of fragmentstatepageradapter @ http://developer.android.com/reference/android/support/v4/app/fragmentstatepageradapter.html
public static class myadapter extends fragmentstatepageradapter { public myadapter(fragmentmanager fm) { super(fm); } @override public int getcount() { return num_items; } @override public fragment getitem(int position) { return arraylistfragment.newinstance(position); } }
i've looked around @ other posts in stackoverflow, still unsure how add/remove pages fragmentstatepageradapter, , how getitem method called. if looking add method myadapter add pages, how done? or not standard way of adding pages? information appreciated.
after adding new item you'll need call myadapter.notifydatasetchanged();
also, seems use const number or items num_items
, you'll need change dynamic can change.
Comments
Post a Comment