I Found some codes for quit an Android application programatically. By calling any one of the following code in onDestroy() will it quit application entirely?
Please think really hard about if you do need to kill the application: why not let the OS figure out where and when to free the resources?
Otherwise, if you're absolutely really sure, use
finish();
As a reaction to @dave appleton's comment: First thing read the big question/answer combo @gabriel posted: Is quitting an application frowned upon?
Now assuming we have that, the question here still has an answer, being that the code you need if you are doing anything with quitting is finish()
. Obviously you can have more than one activity etc etc, but that's not the point. Lets run by some of the use-cases
So in the end, ofcourse, finish()
doesn't kill everthing, but it is still the tool you need I think. If there is a usecase for "kill all activities", I haven't found it yet.