title: Android FragmentStatePagerAdapter
body: <p>I'm working with a FragmentStatePagerAdapter using <a href="http://developer.android.com/reference/android/support/v4/app/FragmentStatePagerAdapter.html" rel="noreferrer">this example</a>.</p>
  
  <p>The MyAdapter class is implemented as follows:</p>
  
  <pre><code>public static class MyAdapter extends FragmentStatePagerAdapter {
          public MyAdapter(FragmentManager fm) {
              super(fm);
          }
  
          @Override
          public int getCount() {
              return NUM_ITEMS;
          }
  
          @Override
          public Fragment getItem(int position) {
              return ArrayListFragment.newInstance(position);
          }
      }
  </code></pre>
  
  <p>The ListFragment class includes the following method to create a new instance:</p>
  
  <pre><code>    /**
       * Create a new instance of CountingFragment, providing "num"
       * as an argument.
       */
      static ArrayListFragment newInstance(int num) {
          ArrayListFragment f = new ArrayListFragment();
  
          // Supply num input as an argument.
          Bundle args = new Bundle();
          args.putInt("num", num);
          f.setArguments(args);
  
          return f;
      }
  </code></pre>
  
  <p>When I create a new fragment state pager adapter in my activity, <code>getItem</code> is called, which in turn calls the <code>newInstance</code> method in the ListFragment class. This is great when I want to create a new fragment. </p>
  
  <p>But it's not clear to me how to modify <code>getItem</code> (if even needed) to get the fragment object <em>when it already exists</em> and the user pages from, for example, page 2 to page 1. I'd like my Activity to retrieve that existing, previously created fragment so that it can run an inner class <code>AsyncMethod</code>, which resides in the fragment class. </p>