title: How to clear back stack of Fragments in Navigation Component?
body: <p>I tried with FragmentManager like this:</p>
  
  <pre><code>Navigation.findNavController(mView).popBackStack()
  </code></pre>
  
  <p>And tried using <code>FragmentManager</code>.</p>
  
  <pre><code>val fm = activity!!.supportFragmentManager
  </code></pre>
  
  <p>1.</p>
  
  <pre><code>fm.popBackStack()
  </code></pre>
  
  <p>2.</p>
  
  <pre><code>fm.popBackStackImmediate()
  </code></pre>
  
  <p>But They didn't work. I mean, It seems like they pop all the fragments.</p>
  
  <p>I also tried applying these attributes in <code>graph_nav.xml</code>:</p>
  
  <pre><code>app:launchSingleTop="true"
  app:popUpToInclusive="true"
  </code></pre>
  
  <p>I applied them in the A fragment and also B fragment.</p>
  
  <p>I want to go to B fragment from A fragment. And I want to clear all the fragment stack before B fragment and just leave B fragment alone.</p>