title: how load fragment in ViewPager only when its selected
body: <p>I'm using 3 <code>Fragments</code> inside a <code>Viewpager</code>, the problem is that I am loading big data in an <code>Asynctask</code> and loaders. On devices like <code>HTC one</code>, it works fine, however, on low-end devices, it takes a lot of time. This is mainly because when I implement the <code>pagerAdapter</code>, I put the Fragments inside an <code>ArrayList</code>, this force the fragments instantiate when the main activity is loaded. What I need is that it just "load" the first fragment (main) and when the user <code>Swype</code>, load the other fragment. its any way to achieve this? this is my pageAdapater</p>
  
  <pre><code>public class PagerAdapter extends FragmentPagerAdapter  {
  
      private final ArrayList&lt;Fragment&gt; mFragments = new ArrayList&lt;Fragment&gt;();
     // private final ArrayList&lt;String&gt; titulos = new ArrayList&lt;String&gt;();
  
     // private int NUM_PAGES =0;
      public PagerAdapter(FragmentManager manager,int num_pages) {
          super(manager);
       //   this.NUM_PAGES = num_pages;
      }
  
  
      public void addFragment(Fragment fragment,String title) {
          mFragments.add(fragment);
              notifyDataSetChanged();
      }
  
      @Override
      public int getCount() {
          //return NUM_PAGES;
         return mFragments.size();
      }
  
      @Override
      public Fragment getItem(int position) {
          return mFragments.get(position);
  
      }
  
  } 
  </code></pre>