When does android activity finish starts

梦想的初衷 提交于 2019-12-03 10:13:33
Yaqub Ahmad

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.

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

onStop()
onDestroy()

Activity instance will be destroyed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!