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 - Unusual behaviour when drawing lots of images onto a large canvas -

how can i manage url using .htaccess in php? -

javascript - Chart.js - setting tooltip z-index -