I\'m developing android applications for a while, and followed a lot of posts about activity life cycle, and application\'s life cycle.
I know Activity.finish
onDestroy()
is meant for final cleanup - freeing up resources that you can on your own,closing open connections,readers,writers,etc. If you don't override it, the system does what it has to.
on the other hand, finish()
just lets the system know that the programmer wants the current Activity
to be finished. And hence, it calls up onDestroy()
after that.
Something to note:
it isn't necessary that only a call to finish()
triggers a call to onDestroy()
. No. As we know, the android system is free to kill activities if it feels that there are resources needed by the current Activity
that are needed to be freed.