clear back stack of activities
<p>I have some activities A, B, C, D. No the way it's set up is like this.</p>

<ol>
<li>When user starts the app, activity A starts.</li>
<li>Based on a preference, which if set to true, immediately starts activity D</li>
<li>From there D starts C and C starts B which then starts A</li>
</ol>

<p>... At this point i want D, C, B removed from the back stack so that user cant go back to them by pressing back from A (but the back button should work like it should when in D, B, C).</p>

<p>so to sum it up i need something like this
<code>D &lt;--&gt; C &lt;--&gt; B --&gt; A</code></p>

<p>I tried using intent flags <code>Intent.FLAG_ACTIVITY_CLEAR_TOP</code> &amp; <code>Intent.FLAG_ACTIVITY_NEW_TASK</code>
but they dont work.
How do i accomplish this??</p>
