android - make viewpagerindicator fragment startup just opened, clicked or swiped and do the loading? -


i use viewpagerindicator, @ startup activity, looks fragment loading. want when fragment startup opened, clicked or swiped , loading. , fragment has not been opened loading when opened, click or swipe later. how it?

this code adapter viewpager

import android.content.context; import android.support.v4.app.fragment; import android.support.v4.app.fragmentmanager; import android.support.v4.app.fragmentpageradapter;  public class viewadapter extends fragmentpageradapter{      private context _context;     string[] page_titles;      public viewadapter(context context, fragmentmanager fm, string[] page_title){         super(fm);         _context = context;         this.page_titles = page_title;     }        @override     public fragment getitem(int position) {         // todo auto-generated method stub          fragment f = new fragment();          switch(position){         case 0:             f = contentactivity.newinstance(_context);             break;          case 1:             f = contentactivity.newinstance(_context);             break;         case 2:             f = contentactivity.newinstance(_context);             break;          }          return f;     }      @override     public int getcount() {         // todo auto-generated method stub         return page_titles.length;     }      public charsequence getpagetitle(int position) {         return page_titles[position];     }    } 

sorry english..

pager = (viewpager) findviewbyid(r.id.pager); pager.setoffscreenpagelimit(1); 

on pager set off screen page limit, defaults pages, want 2 page next current tab loaded before swipe it. take @ documentation method more info


Comments

Popular posts from this blog

c++ - Creating new partition disk winapi -

Android Prevent Bluetooth Pairing Dialog -

VBA function to include CDATA -