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

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -