• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Close Appication

Mikes29

Lurker
Hi,

I'm starting programming for android with eclipse and i have a question, hope you can help.

The app i'm working now have various classes.java and must of them when open depend from the last one, the one o called the new Activity.

So in my first screen i have a method to close my app with the typical "AlertDialog" for confirm if the user really wont to exit.

The problem is this, i can navigate through all screens of my app no problem but when i wont to exit my app goes to one screen of the app.

My question is if there's a way to finish all Activities at the same time so the app closes all an goes back to the operative system of the equipment where the app is running?

This is my exit app:

public boolean onKeyDown(int keyCode, KeyEvent event) {
//Handle the back button
if(keyCode == KeyEvent.KEYCODE_BACK) {
//Ask the user if they want to quit
new AlertDialog.Builder(this)
.setIcon(android.R.drawable.ic_dialog_alert)
.setTitle(getStringResourceByName("quit"))
.setMessage(getStringResourceByName("really_quit"))
.setPositiveButton(getStringResourceByName("yes"), new DialogInterface.OnClickListener() {

@Override
public void onClick(DialogInterface dialog, int which) {
//Stop the activity
finish();
}

}).setNegativeButton(getStringResourceByName("no"), null).show();

return true;
}
else {

return super.onKeyDown(keyCode, event);
}

}

Thank's
 
This is really a user forum. There might a few developers in here but you'll have better luck in a developer forum.
 
Back
Top Bottom