[Android] Application Fundamentals - Component Lifecycles
- Activity lifecycle
onCreate()用來做程式的初使化動作,onDestory()把onCreate()時所要來的資料做釋放的動作。
onPause()時把需要保存的資料在此時保存,onResume()把保存的資料拿回來使用。

上圖裏有三個主要迴路
entire lifetime:
一個Activity的entire lifetime是由onCreate(Bundle)開始,一直到onDestroy()結束。
visible lifetime:
一個Activity的visible lifetime則是指在onStart()到onStop()之間,算是"可視生命時期",在這段時間內,使用者可以在螢幕上看見Activity。
foreground lifetime:
一個foreground lifetime則是指onResume()到onPause()之間,在這個時期的Activity是在所有的Activity的前面,並且直接跟使用者進行互動。
- Service lifecycle
- Broadcast receiver lifecycle
- Processes and lifecycles
Comments
Post a Comment