title: Android: remove activity from stack
body: <p>I have a database tree structure in the backend of my application.
  It basically looks like the following:</p>
  
  <pre><code>List
    |- View
  </code></pre>
  
  <p>I wrote the functionality to transform a View to a List displaying the View. Shown in here:</p>
  
  <pre><code>List
    |- List
       |- View
  </code></pre>
  
  <p>When triggering the <code>toList()</code> function the Application should rebuild the structure in the database, and switch to the new List Activity displaying the list content.</p>
  
  <p>All of the above works, except one thing:</p>
  
  <p>When switching to the new List Activity the previous View should be removed from the stack in order to keep the order when pressing the 'back' button.</p>
  
  <p>I tried with the following intent:</p>
  
  <pre><code>Intent i = new Intent(ViewActivity.this, ListActivity.class);
  // new_item is a DTO containing the needed id to create the List activity
  i.putExtra("selected_item", _new_item);
  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  PostActivity.this.startActivity(i);
  </code></pre>
  
  <p>as well as:</p>
  
  <pre><code>Intent i = new Intent(ViewActivity.this, ListActivity.class);
  // new_item is a DTO containing the needed id to create the List activity
  i.putExtra("selected_item", _new_item);
  i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
  PostActivity.this.startActivity(i);
  </code></pre>
  
  <p>which both didn't work as expected.</p>
  
  <p>Is there any other method of maybe using <code>finish()</code> with the above intent?
  I explicitely don't want to start the activity for a result.</p>