component-->process->thead0
->thread1
->thread3
->thread2
(thread 启动顺序是未知的)
Anroid 生命周期:
void onCreate(Bundle savedInstanceState) -------------------------------------------------------------void onRestart() |
void onStart()
------------------------------------------------------------------------------ |整个生命期
| |
void onResume()
----------------------- 可见(可能部分被覆盖) | |
前台运行 | | |void onPause()
------------------------- | |void onStop()
-------------------------------------------------------------------------------- |void onDestroy()---------------------------------------------------------------------/
A process with an active broadcast receiver is protected from being killed. But a process with only inactive components can be killed by the system at any time, when the memory it consumes is needed by other processes.这是因为进程是有重要等级的,有5个等级:
foreGround
visible process
service process
background process
empty process (用于process cache)
如果想不被轻易Kill,就生成比较“重要”的process. 如生成service