17_activity任务栈和启动模式

夜神安卓模拟器。

如果从第一个页面开启另外一个页面,只要不去调finish()方法咱们上一个页面它是不会退出的,它会留在底下。留在底下的话它设计了这样一个模式就是为了维护一个比较好的用户体验,你的仪器开起来我再往回退。后面这个还能load到前面。这样所有的Activity都放到了Actviity栈里面。



Activities in the system are managed as an activity stack. When a new activity is started, it is placed on the top of the stack and becomes the running activity -- the previous activity always remains below it in the stack, and will not come to the foreground again until the new activity exits.

前面的退了后面的才能load出来。

创建一个Activity它就会放在这个Activity栈当中。这样就维护了一个比较好的用户体验,我页面开了一堆,开完了之后呢我还能再回到之前的状态。

Activity任务栈实际上它有这么一个启动的模式来控制当前的Activity在栈当中究竟能够存在多少个不同的实例。

可以通过这么一个工具去查看当前任务栈的具体情况。

原文地址:https://www.cnblogs.com/ZHONGZHENHUA/p/7141669.html