title: Managing Activities - Android
body: <p>I have a problem with maintaining the activities.</p>
  
  <p>I have activity A, and when starting Activity B from Notification, I should end Activity A, and start Activity B.</p>
  
  <p>In other words, At a same time, in stack, Only Activity A or Activity B should be present. Its' very easy achieve when am starting Activity B from Activity A, by calling <code>finish()</code> in Activity A. But cannot achieve the same when starting activity from notification.</p>
  
  <p>Stack should be like this,</p>
  
  <ul>
  <li>MainActivity -- Activity A</li>
  <li>MainActivity -- Activity B (When starting activity B from notification)</li>
  </ul>
  
  <p>But My Stack looks like,</p>
  
  <ul>
  <li>MainActivity -- Activity A -- Activity B</li>
  </ul>
  
  <p>What Intent flags or launch mode should be used for this.</p>