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
本文详细解析了Android中进程的重要性和不同状态,包括其生命周期的各种回调方法,如onCreate、onStart、onResume等,并解释了如何通过创建特定组件来提高进程的重要性避免被系统轻易回收。
1万+

被折叠的 条评论
为什么被折叠?



