When does android activity finish starts
Asked Answered
P

2

1

When we call activity.finish() will the next android life cycle method be executed?

1) Lets say user clicks on a button
onUserInteraction() we have called activity.finish()
will the action dispatched to the onClicked listener of the button?

2) lets say onStart() we have called activity.finish()
will activity.OnResume() be called?

Phone answered 8/2, 2012 at 8:50 Comment(1)
If you don't get an answer, give it a try and let us know. I'm curious as to what you'll find.Logistician
C
3

When the Activity first time loads the events are called as below:

onCreate()
onStart()
onResume()

When you click the back button OR try to finish() the activity the events are called as below:

onPause()
onStop()
onDestroy()

When you click on Phone button the Activity goes to the background & below events are called:

onPause()
onStop()

Exit the phone dialer & below events will be called:

onRestart()
onStart()
onResume()

I hope its clear now, for detail please see this.

Clementclementas answered 8/2, 2012 at 9:24 Comment(0)
V
1

When activity.finish() is called following lifecycle methods are called for that activity

onStop()
onDestroy()

Activity instance will be destroyed

Veinule answered 8/2, 2012 at 8:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.