Android 四大组件 之 start_activity流程

来源:互联网 发布:java开发笔试题 编辑:程序博客网 时间:2024/06/05 16:38

好了,用上篇介绍的工具,跟踪了下startActivity在system_server中的流程,如下:

The picture below is the flow chart for how the source Activity start a target activity

Major includes four steps:
(1) Preparation, flow chart in blue;
(2) suspend the source activity, in yellow;
(3) Start the target application process once not yet created, also create the
Activity Thread, in Aubergine;
(4) Attach the target activity thread to application, in red, in this step,
application onCreate and activity onCreate are invoked.


System_server中的ActivityStack很重,里面维护了所有的activity的状态的栈,由于时间关系,没有深入研究。Application的onCreate主要是创建植根与此Application上的各个组件的Context。

有一点心得是如果要比较深入了解,必须自己去debug跟踪下,看别人的博客永远只是参考,而且容易打瞌睡。



0 0
原创粉丝点击