title: How to prevent previous fragment to show up after pressing back button using navigation controller?
body: <p>I am trying to use the navigation controller right now. I want to move from <code>LoginFragment</code> to <code>HomeFragment</code>. In <code>LoginFragment</code> I use this code below to move to <code>HomeFragment</code>.</p>
  
  <pre><code>Navigation.findNavController(view).navigate(homeDestination)
  </code></pre>
  
  <p>However, when I tap the back button in the <code>HomeFragment</code>, it will go back to <code>LoginFragment</code>, I expect that when I tap the button it will close the app.</p>
  
  <p>In old way, if I use activity instead of using <code>Fragment</code>, I usually do something like this to get that expected behaviour:</p>
  
  <pre><code>val intent = Intent(this,HomeActivity::class.java)
  intent.flags = Intent.FLAG_ACTIVITY_CLEAR_TASK.or(Intent.FLAG_ACTIVITY_NEW_TASK)
  startActivity(intent)
  </code></pre>
  
  <p>By using those flags, I use to get the expected behavior. But I don't how to implement the same behavior using the navigation controller.</p>