title: the fragments inside an activity are not being removed when I finish the activity
body: <p>the fragments inside an activity are not being removed when I finish the activity
  I have tried a bunch of things and I don't know what is wrong </p>
  
  <ul>
  <li><p>I have removed the fragment one by one in onBack button and it didn't work </p>
  
  <pre><code>if(getSupportFragmentManager().getFragments().size() &gt; 0) {
  
   for (Fragment activeFragment : getSupportFragmentManager().getFragments()) {
  
          getSupportFragmentManager().popBackStack();
          getSupportFragmentManager().beginTransaction().remove(activeFragment);
      }
  
      getSupportFragmentManager().beginTransaction().commit();
  
  }
  </code></pre></li>
  <li><p>this activity is created inside a webview I removed, cleaned cache...  but this didn't work either</p>
  
  <pre><code>public void destroyWebView() {
  
  // Make sure you remove the WebView from its parent view before doing anything.
  _webview.removeAllViews();
  
  _webview.clearHistory();
  
  // NOTE: clears RAM cache, if you pass true, it will also clear the disk cache.
  // Probably not a great idea to pass true if you have other WebViews still alive.
  _webview.clearCache(true);
  
  // Loading a blank page is optional but will ensure that the WebView isn't doing anything when you destroy it.
  
  
  _webview.onPause();
  _webview.removeAllViews();
  _webview.destroyDrawingCache();
  
  // NOTE: This pauses JavaScript execution for ALL WebViews,
  // do not use if you have other WebViews still alive.
  // If you create another WebView after calling this,
  // make sure to call mWebView.resumeTimers().
  _webview.pauseTimers();
  
  // NOTE: This can occasionally cause a segfault below API 17 (4.2)
  _webview.destroy();
  
  // Null out the reference so that you don't end up re-using it.
  _webview = null;
  }
  </code></pre></li>
  </ul>
  
  <p>I put this function inside ondestroy() from the webview </p>
  
  <p>the main activity has this has three tabs(fragments) also and dialog fragment, also I am using intent filter   </p>
  
  <p>any ideas? </p>