Possible Duplicate:
Quitting an application - is that frowned upon?
I have written a app,and override the onBackPress() method:
@Override
public void onBackPressed() {
Log.e("Main Activity", "onBackPressed!");
exitAlert.show();//when the user click the ok button it will call the MainActivity.this.finish();
}
But I found that when the finish()
function is called.I can still find this app running in "Setting->Applications->RunningServices".So I have to manually stop it here.
I cannot understand why it still runs when the finish()
called.
How can I destroy my app by click a dialog?
Thanks in advance!
This is basically a duplicate of quitting-an-application-is-that-frowned-upon? In short, when you finish an activity, the activity gets destroyed but not the process. This is an important aspect of Android programming and is important to understand how it's different from other platforms. Read the post I linked to for lots of details.
In Android your application has a life cycle that is managed by the operating system. There is no way you can actually "kill" you own application. Your app will be placed in the background and when the system determines that resources must be reclaimed your application will be killed automatically.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With