title: Unable to remove fragment from transaction
body: <p>In my app, I need to remove a set of fragments from transaction when the OS recreate my app due to configuration change. I'm trying to do it as following;</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {        
      if (savedInstanceState != null) {
  
          FragmentManager fm = getSupportFragmentManager();
          List&lt;android.support.v4.app.Fragment&gt; fragments = fm.getFragments();
  
          for (Fragment fragment : fragments) {
              if (fragment != null) {
                  if (!((fragment instanceof FragmentType1) ||
                          (fragment instanceof FragmentType2) ||
                          (fragment instanceof FragmentType3))) {
                      FragmentTransaction trans = fm.beginTransaction();
                      trans.remove(fragment).commit();
                  }
              }
          }
  
      }
  
  }
  </code></pre>
  
  <p>Though <code>trans.remove(fragment).commit()</code> is executed successfully, but debugging shows that these fragments are still there in <code>FragmentManager</code>. Can anybody tell what I'm doing wrong here.</p>