问题
My application is always showing in Task Manager when I exit from my application. How do I destroy it? I used the onDestroy()
method, but still it is running. I am using alarm manager and some database operations; is that the problem?
回答1:
Android does not destroy applications unless it needs to. See this answer for more details: Is quitting an application frowned upon?
回答2:
System.exit(0)
will do the job. However, it is not at all recommended. Android does some caching, and saving state, so as to relaunch your appp quicker, the next time you launch it.. so you do not want to be messing around with that.
回答3:
Its not a problem. thats how android works, terminating Application is done by os. But if you want to kill it then you may have to kill the process.
来源:https://stackoverflow.com/questions/7631289/how-to-destroy-my-application