Error in FLAG_ACTIVITY_CLEAR_TOP
<p>i have a 5 activity </p>

<p>1 >> 2 >> 3 >> 4 >> 5</p>

<p>the number 1 activity is first launch class.</p>

<p>number 2 is my list data class</p>

<p>number 3 and 4 is my input data class</p>

<p>number 5 is finishing class</p>

<p>in activity number 5 i put code in button to come back to previous when finished</p>

<p>i have two button back to previous activity.</p>

<ol>
<li>back to activity number 2</li>
<li>back to activity number 1</li>
</ol>

<p>here is button on number 5 activity</p>

<p>1). </p>

<pre><code>Intent intent = new Intent(getApplicationContext(), 2.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
                startActivity(intent);
</code></pre>

<p>2). </p>

<pre><code>Intent dashboard = new Intent(getApplicationContext(), 1.class);
                dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(dashboard);
</code></pre>

<p><strong>EDIT</strong></p>

<p><strong>a</strong>. when i choose button number <strong>2).</strong> in first build application, i click and back to number 1 activity. when I tap the back button , the activity not show number 5 activity again and it works. </p>

<p>senario <strong>a</strong> : 1 >> 2>> 3 >> 4 >> 5 >> 1 >> exit app</p>

<p><strong>b</strong>. when i choose button number <strong>2).</strong> in first build application, i try to input data again and at last in number 5 activity, i choose button number <strong>1).</strong> i click and back to number 2 activity . when I tap the back button , the activity not shows number 5 activity again and it works. </p>

<p>senario <strong>b</strong> : 1 >> 2 >> 3 >> 4 >> 5 >> 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 1 >> tap back button >> exit app</p>

<p><strong>c</strong>. but when i choose button number <strong>1).</strong> in first build application. i click and back to number 2 activity. when I tap the back button , it shows Previous activity again or activity number 5. </p>

<p>senario <strong>c</strong> : 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 5</p>

<p><strong>d</strong>. i want my button number <strong>1).</strong> not show previous or activity number 5 when i tap the back button in my first build application or the last activity is not show without i choose button number <strong>2).</strong> first. </p>

<p>scenario <strong>d</strong> : 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 1 >> exit app</p>

<p>how to fix that?</p>

<p>problem since yesterday till now</p>

<p>sorry for my bad english.</p>

<p><strong>EDIT</strong></p>

<p>in my manifest i declare</p>

<p>number 1 activity is MainMenu.class .</p>

<pre><code>&lt;activity
            android:name="hariff.ltis.mainmenu.MainMenu"
            android:label="@string/app_name" &gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;

                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;
</code></pre>

<p>number 2 is MainPetakTetap.class</p>

<pre><code>&lt;activity
            android:name="hariff.ltis.petaktetap.MainPetakTetap"
            android:label="@string/title_activity_main_petak_tetap" &gt;
        &lt;/activity&gt;
</code></pre>

<p>activity number 3, 4, 5</p>

<pre><code>&lt;activity
            android:name="hariff.ltis.petaktetap.MainUpdate"
            android:label="@string/title_activity_main_petak_tetap" &gt;
        &lt;/activity&gt;

&lt;activity
            android:name="hariff.ltis.petaktetap.UpdateLog"
            android:label="@string/title_activity_main_petak_tetap" &gt;
        &lt;/activity&gt;

&lt;activity
            android:name="hariff.ltis.petaktetap.CPetakTempView"
            android:label="@string/title_activity_main_petak_tetap" &gt;
        &lt;/activity&gt;
</code></pre>
