I am new to android. I am making an application. I have created an exit button in every activity for exiting my application, but I do not know how to kill my application when using the exit button.
I know about finish()
, but it only destroys the current activity.
I have also used a function, which I created in a utility class, where I check the instance of every activity.
if(activityNAme.getInstance()!=null)
then finish();
But in this approach, I have to write a getInstance()
method in every activity.
As I know, the task manager of OS will kill the app if I want it to.
- What is the best way to kill the process, for example in Core Java,
System.exit()
? - Is there any efficient way to kill the application?