title: Fragments not destroyed when recreate() activity
body: <p>I have a support library fragment that sends a network call, and <code>recreate()</code> the parent activity when it receives a specific network response. I can see that the activity does get recreated as I can see the <code>onCreate()</code> and <code>onDestroy()</code> are called.</p>
  
  <p>But after the activity is recreated, the fragment is still there and it got stuck in a loop which keep recreating and making new fragments.</p>
  
  <p>Here's part of the <code>onCreate()</code> of the activity:</p>
  
  <pre><code>    if (someLogic()) {
          fragmentA = new FragmentA();
          FragmentUtil.addFragment(getSupportFragmentManager(), fragmentA);
      } else {
          fragmentB = new FragmentB();
          FragmentUtil.addFragment(getSupportFragmentManager(), fragmentB);
      }
  </code></pre>
  
  <p>FragmentA is the one that does the network call, and FragmentB is the fragment that should be displayed after the <code>recreate()</code>. When I check the list of fragments with <code>getSupportFragmentManager().getFragments()</code> I see 1 instances of FragmentA, and 16 instances of FragmentB.</p>
  
  <p>My question is why does this happen, and how do I fix it?</p>