Android activity life cycle - what are all these methods for?

前端 未结 8 2035
轮回少年
轮回少年 2020-11-21 06:18

What is the life cycle of an Android activity? Why are so many similar sounding methods (onCreate(), onStart(), onResume()) called dur

8条回答
  •  暗喜
    暗喜 (楼主)
    2020-11-21 07:04

    The entire confusion is caused since Google chose non-intuivitive names instead of something as follows:

    onCreateAndPrepareToDisplay()   [instead of onCreate() ]
    onPrepareToDisplay()            [instead of onRestart() ]
    onVisible()                     [instead of onStart() ]
    onBeginInteraction()            [instead of onResume() ]
    onPauseInteraction()            [instead of onPause() ]
    onInvisible()                   [instead of onStop]
    onDestroy()                     [no change] 
    

    The Activity Diagram can be interpreted as:

    enter image description here

提交回复
热议问题