I’ve got 4 activities say Act1, Act2, Act3 and Act4.
A button in Act1 opens Act2, a button in Act2 opens Act3, a button in Act3 opens Act4.
I want two things to be done:
-
I’ve a button in Act4 which directs the user to Act1, the prob is when the user clicks back in Act1, i want to close the app instead of opening the Act4..
-
I’ve option in menu ‘exit’ in all activities when the user choose it, i want to close the app instead of going back to previous activity.
Tried using finish(); but it didn’t meet my requirements.
Use below code in your
Act4‘thMenu.xml‘s exit button –And, in your first activity’s
onCreate()method just put the below code –This will exit your app.