title: How to control Activity flow - Back button versus Home button
body: <p>I have 3 activities in my application:</p>
  
  <pre><code>Activity1 -&gt; Activity2 -&gt; Activity3
  </code></pre>
  
  <p>Inside Activity3, if the user presses Back, I would like to return to Activity2.  In Activity3's onPause event, I added a <code>finish()</code> statement.  That's probably not even necessary, but I wanted to make sure this Activity gets cleaned up.  This works fine.</p>
  
  <p>However, while in Activity3, if the user presses Home or starts a new app (through notification bar or some other means), I want both Activity3 and Activity2 to finish.  If the user returns to this app, he should resume with Activity1.</p>
  
  <p>I have figured out how to do one or the other, but I can't figure out how to handle both cases, if it's even possible.  Can I trap the "Back" button in Activity3 and send a message back to Activity2 telling it not to <code>finish()</code>?  It seems like the Activities follow the same lifecycle flow (Pause, Stop) regardless of what you do to send them to the background.</p>
  
  <p>Just to answer the question of why I want this behavior, imagine that <code>Activity1</code> is a login screen, <code>Activity2</code> is a selection screen, and <code>Activity3</code> is a content screen.  If I press Back from the content page, I want to be able to make a new selection.  If I exit via any other means (Home, notification bar), I want the user to be <code>"logged out"</code>.</p>
  
  <p>Thanks in advance for your help.</p>