i have a 5 activity 

1 >> 2 >> 3 >> 4 >> 5

the number 1 activity is first launch class.

number 2 is my list data class

number 3 and 4 is my input data class

number 5 is finishing class

in activity number 5 i put code in button to come back to previous when finished

i have two button back to previous activity.

1. back to activity number 2
2. back to activity number 1

here is button on number 5 activity

1). 

```
Intent intent = new Intent(getApplicationContext(), 2.class);
                intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); 
                startActivity(intent);

```

2). 

```
Intent dashboard = new Intent(getApplicationContext(), 1.class);
                dashboard.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                startActivity(dashboard);

```

**EDIT**

**a**. when i choose button number **2).** 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. 

senario **a** : 1 >> 2>> 3 >> 4 >> 5 >> 1 >> exit app

**b**. when i choose button number **2).** in first build application, i try to input data again and at last in number 5 activity, i choose button number **1).** 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. 

senario **b** : 1 >> 2 >> 3 >> 4 >> 5 >> 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 1 >> tap back button >> exit app

**c**. but when i choose button number **1).** 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. 

senario **c** : 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 5

**d**. i want my button number **1).** 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 **2).** first. 

scenario **d** : 1 >> 2 >> 3 >> 4 >> 5 >> 2 >> tap back button >> 1 >> exit app

how to fix that?

problem since yesterday till now

sorry for my bad english.

**EDIT**

in my manifest i declare

number 1 activity is MainMenu.class .

```
<activity
            android:name="hariff.ltis.mainmenu.MainMenu"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>

```

number 2 is MainPetakTetap.class

```
<activity
            android:name="hariff.ltis.petaktetap.MainPetakTetap"
            android:label="@string/title_activity_main_petak_tetap" >
        </activity>

```

activity number 3, 4, 5

```
<activity
            android:name="hariff.ltis.petaktetap.MainUpdate"
            android:label="@string/title_activity_main_petak_tetap" >
        </activity>

<activity
            android:name="hariff.ltis.petaktetap.UpdateLog"
            android:label="@string/title_activity_main_petak_tetap" >
        </activity>

<activity
            android:name="hariff.ltis.petaktetap.CPetakTempView"
            android:label="@string/title_activity_main_petak_tetap" >
        </activity>

```