Back button doesn't switch to previous activity, but it exits the Android app
<p>I have an app that contains 2 activities: A1 and A2. When I run the app it opens A1 activity. Then it opens A2 by pressing the button (I use startActivityForResult(intent, 0)). Then if I pressing Back it returns to A1. Everything is ok.</p>

<p>But if I am in A2 activity and <strong>switching to another application</strong> and then returning back to my app, then I'm pressing Back and the application exits instead of switching to A1 activity.
What can I do to prevent such situation?</p>

<p>The code that calls A2 from A1:</p>

<pre><code>@Override
public void onClick(View v) {
  Intent intent = new Intent(getApplicationContext(), A2.class);
  startActivityForResult(intent, 0);
}
</code></pre>

<p>Declaration in AndroidManifest.xml:</p>

<pre><code>&lt;activity
    android:name="A1"
    android:launchMode="singleInstance"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt;
&lt;/activity&gt;

&lt;activity
    android:name="A2"
    android:launchMode="singleInstance"
    android:theme="@android:style/Theme.NoTitleBar.Fullscreen" &gt;
&lt;/activity&gt;
</code></pre>
