title: Android multiple activity tasks when application is killed
body: <p>The app has 2 tasks of activities:</p>
  
  <ul>
  <li><strong>TASK 1</strong>
  <ul>
  <li><code>Activity</code> A (launcher)</li>
  <li><code>Activity</code> B</li>
  </ul></li>
  <li><strong>TASK 2</strong>
  <ul>
  <li><code>Activity</code> C   &lt;---- that's where the stack points at in the example.</li>
  </ul></li>
  </ul>
  
  <p>Now try that:</p>
  
  <ol>
  <li>Go to the recent apps carrousel (you know by clicking the button on the right of the Home button in newer phones). </li>
  <li>Swipe all the apps out.</li>
  <li>Your application is killed and a new <code>Application</code> instance is created (<code>Application#onCreate()</code> is called).</li>
  <li>Android tries to show the Activity C of the <strong>TASK 2</strong>.</li>
  </ol>
  
  <p>The funny thing is that if you're here:</p>
  
  <ul>
  <li><strong>TASK 1</strong>
  <ul>
  <li><code>Activity</code> A (launcher)</li>
  <li><code>Activity</code> B &lt;---- here</li>
  </ul></li>
  </ul>
  
  <p>...and you do repeat the scenario, your application is killed and android goes back to the Home screen as I think it should.</p>
  
  <p>In short, it looks like Android does not clear all the tasks when killing the application. This is only true in that very precise scenario. Go to Settings > Applications > Your App > Force Stop, and you will see that it does clear all the tasks.</p>
  
  <p>Anything we can do to force Android to kill all the tasks when killing the application?</p>