Hello everyone,
I have created a option menu and it works for opening new activities but i am trying to make one of the button function as an "exit" option.
"
MenuItem item4 = menu.findItem(R.id.exit);
Intent intent4 = new Intent(this, elec24.class);
item4.setIntent(intent4);
"
This is the code i have used for the other buttons. How can i modify it so that it exits the app?
Please bare in mind this app has multiple activities and so the exit button will need to close the current one, and any others still open (assuming this happens in android?)
Thanks for any help.
I have created a option menu and it works for opening new activities but i am trying to make one of the button function as an "exit" option.
"
MenuItem item4 = menu.findItem(R.id.exit);
Intent intent4 = new Intent(this, elec24.class);
item4.setIntent(intent4);
"
This is the code i have used for the other buttons. How can i modify it so that it exits the app?
Please bare in mind this app has multiple activities and so the exit button will need to close the current one, and any others still open (assuming this happens in android?)
Thanks for any help.