I have developed an application and there are many activities in this project. In setting activity, I place one exit button, on click event of that exit button I want to exit whole application. So what should I do for that?
6 Answers
if you are calling activity B from an activity A.and C from B
A->B
use startactivityforresult from A
and again B->C
use startactivityforresult from B
and when you want to exit from C then setResult(i.e. RESULT_OK) and finish C.and in OnActivityResult() in B,check if resultcode == RESULT_OK then again finish B and setresult(RESULT_OK) for A.same procedure will follow to finish A.
this will exit you from the application.and application will start from A not from C.
2 Comments
1 Comment
"Android" programs aren't supposed to have an EXIT button. See any app that comes pre-installed in your device and check if any of them actually have an EXIT button. Exit makes no sense. It just ends up giving a sense of false security to the user.