i'm working in and android application my app contains more than 10 activities(say activity A,B etc) in which the first activity is a splash screen and next one is a list view on selecting items in a listview navigating to another different activities.my problem is that when i single press hardware back button from any inner activities(A,B,C etc)it must navigate to the listview
and when i double press the back button from any other activities the app must get closed.till here the app works perfectly.but my problem is that when i press the back button once from my any of the inner page it navigate to listview then if i press the back button once from listview my app is geting exited i dont want this i need my app gets closed only when i double click the back button from the listview.is it possible?
my code for button press is this
public void onBackPressed() {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_HOME);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
finish();
}
and my manifest.xml
<activity
android:name="learnersseries.mathematics.complexnumbers.Firstintro"
android:screenOrientation="portrait"
android:launchMode="singleTop"
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="Myintegralpage"
android:screenOrientation="portrait"
>
<intent-filter></intent-filter>
</activity>
<activity android:name="myimagine"
android:screenOrientation="portrait"
>
<intent-filter></intent-filter>
</activity>
<activity android:name="Myintroductionpage"
android:screenOrientation="portrait"
>
<intent-filter></intent-filter>
</activity>
<activity android:name="MainActivity"
android:noHistory="false"
android:screenOrientation="portrait"
>
<intent-filter></intent-filter>
</activity>
<activity android:name="Complexnumbers"
android:screenOrientation="portrait"
>
<intent-filter></intent-filter>
</activity>
<activity android:name="Equality"
android:screenOrientation="portrait"
>