title: Clear all activities in a task?
body: <p>I have a splash screen activity, then a login activity. My history stack looks like:</p>
  
  <pre><code>SplashActivity
  LoginActivity
  </code></pre>
  
  <p>when the user successfully logs in via LoginActivity, I want to start WelcomeActivity, but clear the entire stack:</p>
  
  <pre><code>SplashActivity
  LoginActivity // launches WelcomeActivity -&gt;
  WelcomeActivity
  
  // but now all three are in the history stack, while I only
  // want WelcomeActivity in the stack at this point.
  </code></pre>
  
  <p>Is there some flag I can use to do that?</p>
  
  <pre><code>// LoginActivity.java
  Intent intent = new Intent(this, WelcomeActivity.class);
  intent.addFlag(Intent.FLAG_ACTIVITY_CLEAR_TASK);
  startActivity(intent);
  finish();
  </code></pre>
  
  <p>Not sure if using the FLAG_ACTIVITY_CLEAR_TASK will clear out all activities in my task or not. I can do this 'manually' by unwinding the stack by using startActivityForResult() calls, but will be more fragile and more code to maintain.</p>
  
  <p>Thanks</p>