[Android]当Activity启动模式为singleTask时的生命周期

01-09 22:59:24.317 13063-13063/com.dongua.activitytest I/Activity1: onCreate: 
01-09 22:59:24.319 13063-13063/com.dongua.activitytest I/Activity1: onStart: 
01-09 22:59:24.321 13063-13063/com.dongua.activitytest I/Activity1: onResume: 
01-09 22:59:29.501 13063-13063/com.dongua.activitytest I/Activity1: onStop: 
01-09 22:59:37.846 13063-13063/com.dongua.activitytest I/Activity1: onRestart: 
01-09 22:59:37.846 13063-13063/com.dongua.activitytest I/Activity1: onStart: 
01-09 22:59:37.847 13063-13063/com.dongua.activitytest I/Activity1: onResume: 

即再次启动会调用onRestart-onStart-onResume

当2个都为singleTask的Activity互相跳转时,则会出现如下情况
activity2 跳转到 activity1 activity1再跳转到activity2 后边activity1执行了onDestroy方法被销毁了

01-09 23:24:37.547 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onCreate: 
01-09 23:24:37.548 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onStart: 
01-09 23:24:37.550 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onResume: 
01-09 23:24:40.636 7445-7445/com.dongua.activitytest I/Activity12: Activity1+onCreate: 
01-09 23:24:40.638 7445-7445/com.dongua.activitytest I/Activity12: Activity1+onStart: 
01-09 23:24:40.639 7445-7445/com.dongua.activitytest I/Activity12: Activity1+onResume: 
01-09 23:24:40.971 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onStop: 
01-09 23:24:52.602 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onRestart: 
01-09 23:24:52.603 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onStart: 
01-09 23:24:52.604 7445-7445/com.dongua.activitytest I/Activity12: Activity2+onResume: 
01-09 23:24:52.960 7445-7445/com.dongua.activitytest I/Activity12: Activity1+onStop: 
01-09 23:24:52.960 7445-7445/com.dongua.activitytest I/Activity12: Activity1+onDestroy: 

你可能感兴趣的:(Android)