title: Remove all activities except the first one
body: <p>I want to program Home button, so it will remove all <code>Activities</code> in stack, except one. I did it like in here: <a href="https://stackoverflow.com/questions/6298275/how-to-finish-every-activity-on-the-stack-except-the-first-in-android">How to finish every activity on the stack except the first in Android</a></p>
  
  <pre><code>public boolean onOptionsItemSelected(MenuItem item) {
      int itemId = item.getItemId();
      switch (itemId) {
      case android.R.id.home:
          Intent intent = new Intent(this, AMainActivity.class);
          intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
          startActivity(intent);
          break;
  ...
  </code></pre>
  
  <p>but this way doesn't suit me, because it removes ALL <code>Activities</code> (including the first one) and starts the first one again. For example - if I check user password in <code>onCreate()</code>, he would be asked again.
  How to remove all <code>Activities</code> from stack, but so the first one will not be "touched" ?</p>