title: ViewPager in TabFragment is not loading a second time
body: <p>I'm trying to make an app that has a <code>ViewPager</code> in a Fragment that is part of a <code>TabHost</code>. Everything works out fine. I have my tabbar, I can switch tabs. When I switch to the tab with the <code>ViewPager</code>, all is shown correctly.</p>
  
  <p>However, as soon as I leave this tab with the <code>ViewPager</code> and return this tab, my content is not shown. If I scroll to the side twice I do see my next image and if I go back two times I also see the images are loaded (probably the <code>offscreenloaded</code>).</p>
  
  <p>See that my <code>TabFragment</code> is being reinstantiated when I return to it but the fragments in the <code>ViewPager</code> aren't.</p>
  
  <pre><code>@Override
  public void onActivityCreated(Bundle savedInstanceState) {
  
      mProjectText = (TextView) getView().findViewById(R.id.projectText);
      mProjectText.setText(mActiveProject.getInspirationText());
  
      mAdapter = new AlbumAdapter(getFragmentManager(), mActiveProject.getInspiration());
  
      mPager = (ViewPager)getView().findViewById(R.id.pager);
      mPager.setAdapter(mAdapter);
  
      super.onActivityCreated(savedInstanceState);
  }
  
  public class AlbumAdapter extends FragmentStatePagerAdapter {
  
  private ArrayList&lt;ProjectContent&gt; mItems;
  
  public AlbumAdapter(FragmentManager fm, ArrayList&lt;ProjectContent&gt; items) {
      super(fm);
      this.mItems = items;
  }
  
  @Override
  public Fragment getItem(int position) {
      return AlbumContentFragment.newInstance(mItems.get(position));
  }
  
  @Override
  public int getCount() {
      return mItems.size();
  }
  
  @Override
  public int getItemPosition(Object object) {
      return POSITION_NONE;
  }}
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/4BArG.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/4BArG.jpg" alt="The mockup for the app"></a></p>