When does android activity finish starts

前端 未结 2 2056
予麋鹿
予麋鹿 2021-02-11 09:43

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

1) Lets say user clicks on a button
onUserInteraction()

相关标签:
2条回答
  • 2021-02-11 10:11

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

    onStop()
    onDestroy()
    

    Activity instance will be destroyed

    0 讨论(0)
  • 2021-02-11 10:16

    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.

    0 讨论(0)
提交回复
热议问题