Android Fragment stack empty after rotate
<p>I'm using a <code>FragmentActivity</code> to display a stack of <code>Fragments</code> in a single activity app. This is working fine and I can move through the fragments and hit back to go back up the stack until I rotate the device when I end up with the <code>Fragment</code> on the top of the stack rotated but hitting the back button takes me back to the root <code>Fragment</code> with all other <code>Fragment</code>s in between gone.</p>

<p>I'm using the following code to add a <code>Fragment</code> to the stack:</p>

<pre><code>FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.mainContentViewContainer, newFragment, "DetailFragment");
transaction.addToBackStack(null);
transaction.commit();
</code></pre>

<p>What could be causing the stack to be empty after rotate?</p>
