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

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -