title: How to correctly replace a fragment in a view pager?
body: <p>I have the following structure of my app:</p>
  
  <pre><code>v4 FragmentActivity --&gt; v4 ViewPager --&gt; v4 Fragment
                                       --&gt; v4 ListFragment
  </code></pre>
  
  <p>I'm using <a href="http://actionbarsherlock.com/" rel="nofollow">ActionBarSherlock</a> (which I would really recommend), and the structure of the Activity is based on the demo at <a href="https://github.com/JakeWharton/ActionBarSherlock/blob/master/samples/demos/src/com/actionbarsherlock/sample/demos/app/ActionBarTabsPager.java" rel="nofollow">https://github.com/JakeWharton/ActionBarSherlock/blob/master/samples/demos/src/com/actionbarsherlock/sample/demos/app/ActionBarTabsPager.java</a> . So the two fragments are displayed as two tabs for the user.</p>
  
  <p>When a user clicks an element of the ListFragment I want to load an url in a WebView in the same place as the list is. That is, I want to replace the ListFragment (put it on the back stack) with a new WebView.</p>
  
  <p>So far I've tried using <a href="http://developer.android.com/reference/android/support/v4/app/FragmentTransaction.html#replace%28int,%20android.support.v4.app.Fragment,%20java.lang.String%29" rel="nofollow">FragmentTransaction.replace()</a> from the Activity. That kind of works, except two issues:</p>
  
  <ul>
  <li>The ListFragment doesn't display the WebView before I rotate the device (i.e. the acitity is recreated).</li>
  <li>The content of the other tab disappears (it's just blank)</li>
  </ul>
  
  <p>What is the correct way to replace the ListFragment with another Fragment?</p>