finish() and the Activity lifecycle

Karl Giesing picture Karl Giesing · Sep 29, 2012 · Viewed 31.5k times · Source

I'm learning Android programming for a class, and I have a quick question about how finish() fits into the Activity lifecycle.

When you make a call to finish(), what lifecycle callback is started? I presume it's onPause(), then onStop() and onDestroy(). Is this correct?

Really, I just want to make sure that it doesn't jump straight to onDestroy().

Answer

ceph3us picture ceph3us · May 14, 2015

Really, I just want to make sure that it doesn't jump straight to onDestroy(). ???

NO!

but there is one exception when calling finish() result in activity lifecycle break this happens when u call finish() from onCreate() method in which case onDestroy() will be immediately called!

http://developer.android.com/reference/android/app/Activity.html#onCreate(android.os.Bundle)