android - How to make if back to previous fragment Tab ViewPagerIndicator not reload again? -


i have error tab viewpagerindicator, if if or swipe previous fragment reload...

this code fragment

package com.droidersuin.project.viewpagerindicator;   import com.droidersuin.project.app.contentactivity;  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];     }    } 

if swipe fragment 0 fragment index 1 , swipe index 0, reload content, want make if swipe previous fragment not reload again ? how it

thanks... sorry english ..

try set viewpager's offscreenpagelimit this:

 mpager.setoffscreenpagelimit(3);  

it keep 3 pages in memory, , after them start reloading.


Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

css - Firefox for ubuntu renders wrong colors -