first of all sorry for my english. i am new at android and working on app.
my app has 8 activities and they usually starting by click and
like this, activity1-> 2->3->4->5->6->7->activity8 .
as usual,
when i press the back button 7 times and it closes activities act8 to act1. if i am at activty1 back button closes the app. i want to make a alerdiaolog there to alert me like "it is your last activity!!". but when i use public void onBackPressed() command to show diaolog such as" are u sure to exit ?" , it is not only prevent app closing, it is also prevent closing the other activies, for example if i am at the 8th activity i cant go back to 7th activity, app shows me alert dialog "are u sure to exit ?"
to sum up;
- where should i put the public void onBackPressed() code , if i want to prevent only closing app except activies?
- can i use code like this , if(myactivity is the lastone or main activity ) { "are sure to exit the app ?"}
Sorry for language again, thank you for your interest.