Reputation: 3442
I have developed an application which is working fine.
In that i have used some static variables and also set Application level variables. My problem is that even after setting finish() on each activity, application is showing in Running mode.
After closing the application, when i start the application after sometime, it will set the last changes.
How can i destroy my application?
Upvotes: 3
Views: 17586
Reputation: 685
Please go through these methods used for the destroying the activities
setResult() finish() and onActivityresult()
After calling setResult() call finish() for the activity that you want to finish & then in it's parent activity override onActivityResult() in this you can finished your application.
The solution given by oli is right android will destroy your application running. But I want add, only if it is lacking in system resources.
For more help please go through following link.
http://developer.android.com/reference/android/app/Activity.html
Upvotes: 0
Reputation: 3442
I have checked that application does not release the resources. So, what i have done is :
Process.killProcess(Process.myPid());
It will kill the application. It helps me a lot.
Upvotes: 3
Reputation: 4934
I think the correct answer is "you shouldn't".
It doesn't matter if your app is still running after the user stops using it. Android will kill it when/if it needs to.
Your app most likely shouldn't even have an exit button.
Upvotes: 12
Reputation: 2415
I hope you have called onDestroy for your activity.
Secondly, are you saving your preference some where else??
Upvotes: 0