Android activity/task order issue
<p>I have an app with 2 main activities and a service. The app starts with activity 1, and the service launches activity 2 via an intent upon detection of an app launch A. Activity 2 then does some stuff and calls finish(), returning to app A.</p>

<p>However, if I launch app A when I'm in activity 1, activity 2 appears and returns to activity 1 once it's done instead of returning to app A. If I then tap on the back button, I return to app A.</p>

<p>On the other hand, if I go back to the home screen when I'm on activity 1 and start app A, activity 2 appears, and now returns to app A once it's done. This is the behavior I'm looking for, but it only happens when I'm not starting out from activity 1.</p>

<p>Why does this happen? I'm launching activity 2 via an intent in the service with the FLAG_ACTIVITY_NEW_TASK flag.</p>

<p>Thanks.</p>
