title: Android Fragments recreated on orientation change
body: <p>I'm developing an app that basically has an ActionBar. When my app starts, the Activity creates the fragments and attaches them to each tab, so when I switch I get different views.</p>
  
  <p>The problems arise when I try to rotate the device. After some struggle, I noticed that Android automatically recreates the previously added fragments like this:</p>
  
  <pre><code>SummaryFragment.onCreate(Bundle) line: 79   
  FragmentManagerImpl.moveToState(Fragment, int, int, int) line: 795  
  FragmentManagerImpl.moveToState(int, int, int, boolean) line: 1032  
  FragmentManagerImpl.moveToState(int, boolean) line: 1014    
  FragmentManagerImpl.dispatchCreate() line: 1761 
  DashboardActivity(Activity).onCreate(Bundle) line: 864  
  ...
  </code></pre>
  
  <p>and then I recreate the fragments as usual. So I have the "real" fragments that I expect to work correctly and their "hidden" Android-created counterparts that make my app crash. How can I avoid this behavior? I already tried to call setRetainInstance(false) in the SummaryFragment.</p>
  
  <p>Thank you</p>