Bring an activity to front using FLAG_ACTIVITY_REORDER_TO_FRONT
<p>My activity stack is A1 B A2, with A2 at the top. </p>

<p>A1 and A2 are instances of the same activity, A. Now in A2, I want A2 to exit and bring A1 to front, so the final stack should be B A1. How should I implement it?</p>

<p>My current code that A2 executs is:</p>

<pre><code>        finish();

        intent = new Intent(this, A.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_PREVIOUS_IS_TOP);
        startActivity(intent);
</code></pre>

<p>The above code brought B to front, so the final stack is A1 B, which is not what I expected.</p>

<p>Any idea?</p>

<p>Thanks.</p>
