Android add fragments to end of FragmentStatePagerAdapter -


i want adapter add page each time reaches last page. here code tried using:

static int items = 2;  public static class myadapter extends fragmentstatepageradapter implements onpagechangelistener{     public myadapter(fragmentmanager fragmentmanager)      {         super(fragmentmanager);     }      @override     public int getcount()      {         return items;     }      @override     public fragment getitem(int position)      {         if (position >= items-1)         {             items++;             notifydatasetchanged();         }         fragment f = reviewfragment.init(position);          return f;     } 

i suggest this:

public static class myadapter extends fragmentstatepageradapter implements onpagechangelistener{     public myadapter(fragmentmanager fragmentmanager) {         super(fragmentmanager);     }      @override     public int getcount() {         return integer.max_value;;     }      @override     public fragment getitem(int position) {         fragment f = reviewfragment.init(position);          return f;     } } 

Comments

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -