title: Restoring a fragment using FragmentPagerAdapter
body: <p>I have an application using two tabs, both containing fragments.   I am using the FragmentPagerAdapter to manage tab changes.  All works fine with two tabs.</p>
  
  <p>I recently added a third tab and am having a bit of trouble.  tab1(fragment1) is a LinearLayout of small fragments.  tab2(fragment2) is a simple layout of text.  tab3(fragment3) is also a simple layout of text.  </p>
  
  <p>If I switch between tab1 and tab2 both work properly and retain their states.  However, if I switch between tab1 and tab3, tab3 shows the text properly but tab1 shows a blank tab.</p>
  
  <p>I know that if a tab goes more than 1 position off the current position the fragment will be destroyed and the fragment will need to be recreated. Does <code>FragmentPagerAdapter</code> not do this automatically?  </p>
  
  <p>I discovered that if I rotate the device (with tab1 selected), the tab1 fragment will be restored with its correct state so the fragment is not being destroyed.  It seems like there is an issue with the layout not being correctly recreated by the <code>ViewPager</code> but this is only a guess.</p>
  
  <p>As a work around I set <code>myViewPager.setOffscreenPageLimit(2)</code> and the layout is retained.  I would like to get this to work as I think its supposed to without forcing the fragments to stay in memory. </p>