title: popBackStack() after addToBackStack does not work
body: <p>My project contains two fragment : </p>
  
  <ul>
  <li>FragmentA : the fragment loaded by default when the app starts</li>
  <li>FragmentB : replace the <code>fragmentA</code> when a click on a button is done.</li>
  </ul>
  
  <p>This is the XML of my main view :</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"&gt;
  
      &lt;fragment
          android:id="@+id/main_fragment_container"
          android:name="fragmentA"
          android:layout_width="match_parent"
          android:layout_height="match_parent"&gt;
      &lt;/fragment&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>When I wish to replace the <code>FragmentA</code> by the <code>FragmentB</code>, I use this code : </p>
  
  <pre><code>FragmentTransaction fragmentTransaction = getSupportFragmentManager()
              .beginTransaction();
  fragmentTransaction.addToBackStack(null);
  fragmentTransaction.replace(R.id.main_fragment_container, new FragmentB());
  fragmentTransaction.commit();
  </code></pre>
  
  <p>This code works fine. My FragmentA is replaced by the new <code>FragmentB</code>. But when a click is done on the back button, I wish replace the <code>FragmentB</code> by the <code>FragmentA</code> by using <code>popBackStackImmediate()</code>.</p>
  
  <p>This is the code I use: </p>
  
  <pre><code>if (getSupportFragmentManager().getBackStackEntryCount() &gt; 0){
      boolean done = getFragmentManager().popBackStackImmediate();
      fragmentTransaction.commit();
  }
  </code></pre>
  
  <p>The function <code>popBackStackImmediate</code> return always false and the <code>FragmentB</code> still in foreground.</p>
  
  <p>Why the FragmentA does not replace the FragmentB when I call <code>popBackStackImmediate</code> ? Is anybody has an idea to solve my problem?</p>
  
  <p>thanks in advance</p>