Restart app from first activity
<p>In my app I have the following sequence:</p>

<pre><code>A-&gt;B-&gt;C
</code></pre>

<p>In <code>C</code>, there is a button which upon pressing should take me straight back to <code>A</code>. The problem is that after it goes back to <code>A</code>, upon pressing back it takes me to <code>C</code> then <code>B</code> then <code>A</code> and then finally exists.</p>

<p>What I want is that when the app goes from <code>C</code> to <code>A</code>, pressing back should exit the program (and not take me back to <code>C</code>)</p>

<p>Following code in <code>A</code> does not work:</p>

<pre><code>    android:clearTaskOnLaunch="true"
    android:launchMode="singleTask"
</code></pre>

<p>Code to go back to <code>A</code>:<code>startActivity(new Intent(trip.this, login.class));</code></p>