title: Android Activity back stack and multitasking support
body: <p>I have an app that supports multitasking (working in the background), however I have run into problems with the android backstack.</p>
  
  <p>This is what I have:</p>
  
  <p>Activity A starts Activity B for result, so...</p>
  
  <p>Activity A --> Activity B</p>
  
  <p>If when at Activity B the user long presses the <strong>home</strong> button and switches to another application (say the browser for example) and then long presses the <strong>home</strong> button again and comes back to my app, they will be at Activity B, however the back stack at this time will look like this:</p>
  
  <p>Activity A --> Internet Browser --> Activity B</p>
  
  <p>So when I do <code>finish()</code> to send back a result from my Activity B it does not come back to my Activity A, but rather to the Internet Browser...</p>
  
  <p>This is also the case if the user doesn't use long press of the <strong>home</strong> button, but also uses the <strong>home</strong> button to come back to their launcher and then uses long press <strong>home</strong> button to come back to my app. In this case the back stack is even worse:</p>
  
  <p>Home Launcher --> Activity B</p>
  
  <p>So when I do <code>finish()</code> on Activity B, the user gets back to their home screen and they can never get back to Activity A except for if they go and start the app again from their app drawer.</p>
  
  <p>Is there any way to implement multitasking work in this case? Activity B needs to always return back a result to Activity A no matter what the user opened in-between these two.</p>