title: Removing a Fragment from the back stack
body: <p>I have a 3 fragments in an activity when the a tablet is held in portrait. However I only have 2 of these fragments when in landscape. The problem I am having is when going from portrait to landscape the activity is creating the 3rd fragment. I receive and error as this fragment cannot be created. </p>
  
  <p>I have worked out that this fragment is being created because it is in the back stack.</p>
  
  <p>I have tried to remove the fragment in the onDestroy method by using </p>
  
  <pre><code>FragmentTransaction f = fragmentManager.beginTransaction();
  f.remove(mf);
  f.commit();
  </code></pre>
  
  <p>However the I get an error saying that I cannot use this function after the onSaveInstanceState</p>
  
  <p>What would be the correct way of taking this fragment out of the back stack?</p>
  
  <h2>Update</h2>
  
  <p>I should probably add that the fragment I am having problems with is a mapFragment from this libary</p>
  
  <p><a href="https://github.com/petedoyle/android-support-v4-googlemaps" rel="noreferrer">https://github.com/petedoyle/android-support-v4-googlemaps</a></p>
  
  <p>The way I use it is like so</p>
  
  <pre><code>mf = MapFragment.newInstance(1, true);
  
  ft = fragmentManager.beginTransaction();
  ft.replace(R.id.mapContainer, mf);
  ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE);
  ft.addToBackStack("map");
  ft.commit();
  </code></pre>