Remove "start"-activity from the history
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/1898886/removing-an-activity-from-the-history-stack">Removing an activity from the history stack</a>  </p>
</blockquote>



<p>I am looking for a solution to remove the StartActivity from the history stack. 
The StartActivity is the one that is being started at the beginning. I am using this Class to check some user values and want to redirect the user to the MainActivity if all is correct. </p>

<p>I have tried to set a flag:</p>

<pre><code>addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
</code></pre>

<p>but this does not do what it should. </p>

<pre><code>App starts -&gt; StartActivity -&gt; MainActivity -&gt; PRESS back -&gt; the app should end
</code></pre>

<p>it does:</p>

<pre><code>App starts -&gt; StartActivity -&gt; MainActivity -&gt; PRESS back -&gt; StartActivity
</code></pre>

<p>Thank for your help!</p>

<p>Edit: This is the code i am using to start the MainActivity:</p>

<pre><code>Intent i = new Intent(context, DashBoardActivity.class);
i.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(i);
</code></pre>
