Arber
Arber

Reputation: 5

How to force close my Android application?

Well apparently my android application doesnt close when I finish the activity so it there a way to force close it including any activity in my app that could be opened?

Upvotes: 0

Views: 2683

Answers (3)

Gallal
Gallal

Reputation: 4262

Call finish() at the point when you want it to close. For example in onPause() if you want it to finish when the activity is no longer the topmost one.

I personally suggest you simply make sure your app does not do anything when it is not active and let the system worry about 'finishing' it.

Upvotes: 0

Aleadam
Aleadam

Reputation: 40381

The fact that the process is still alive does not mean that the Activities did not finish. The process might be kept for a while until the OS decides to kill it.

If you have activities that do not finish properly, make sure that you did not leave a thread running.

There is no method in the API to close an Application. It is up to the OS to terminate it when it is convenient. The last resource is to kill the process, but you should never need to use that in your apps.

Upvotes: 1

Kaj
Kaj

Reputation: 10949

Make sure that threads that you have started terminate, and then invoke finish

Btw. How have you verified that you activity isn't closing?

Upvotes: 0

Related Questions