Activity methods:onCreate() and onDestroy()

后端 未结 2 1545
别跟我提以往
别跟我提以往 2021-01-31 00:12

When an activity is created for the first time then system calls the OnContentChanged() method as the first method and last call by system is the OnDetachedFr

相关标签:
2条回答
  • 2021-01-31 00:42

    http://developer.android.com/reference/android/app/Activity.html#onContentChanged%28%29

    onContentChanged() will not be called the first time the actiivity is visible to user.

    It will be called,say when the user changes orientation of the mobile..or other configurations..

    0 讨论(0)
  • 2021-01-31 00:49

    onCreate():

    When an activity starts its life onCreate() is called. It is called only once in the lifecycle of an activity.

    onDestroy():

    onDestroy() is called when an activity finishes its life cycle. It is also called once in the lifecycle of an activity.

    onContentChanged():

    This hook is called whenever the content view of the screen changes (due to a call to Window.setContentView or Window.addContentView). For example you add new view to activity or want to refresh the list by calling notifyDataSetChanged().

    onDetachedFromWindow():

    Called when the main window associated with the activity has been detached from the window manager. For example, it is called when the current Activity goes into background or another activity came infront of current activity.

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