title: How to clear backStack of support FragmentManager?
body: <p>Is there any way, how to clear backStack of support FragmentManager without calling onCreateView() in stored fragments?</p>
  
  <p>I understand fragment lyfe cycle and calling onDestroyView() and onCreateView() when it is popped.
  <a href="http://developer.android.com/guide/components/fragments.html#Creating" rel="nofollow">http://developer.android.com/guide/components/fragments.html#Creating</a></p>
  
  <p>Also I know how to pop all fragments from backstack with</p>
  
  <pre><code>mFragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
  </code></pre>
  
  <p>or</p>
  
  <pre><code>for(int i = 0; i &lt; mFragmentManager.getBackStackEntryCount(); ++i) {            
       mFragmentManager.popBackStack();
  }
  </code></pre>
  
  <p>but both ways are calling onCreateView() and other lyfe cycle methods until to onDestroyView() and onDestroy().</p>
  
  <p>But is there any way, how to <strong>clear</strong> this backstack with calling only from onDestroyView() and not from onCreateView() (inside of fragments)?</p>
  
  <p>Or is there any way how to do replace transaction with clearing previous fragments?</p>
  
  <p>For example, I want clear backstact before I do transaction:</p>
  
  <pre><code>FragmentManager fragmentManager = getSupportFragmentManager();
  fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE);
  fragmentManager.beginTransaction().replace(R.id.content, fragment).commit();
  </code></pre>