How to clear the previous activity after starting new activity
<p>Hello guys Im having a problem in how to clear the previous activity after starting new activity</p>

<p>I already try this code but it doesn't work when I press back button</p>

<p>here are the code ive tried</p>

<pre><code>startActivity(new Intent(this, ErrorActivity.class).setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
</code></pre>

<p>are they any other ways to do it or something missing from my code ??
I appreciate the for your reply thx </p>
