第一种情况:
A—>B—>C
A在onCreate时启动B;
B在onCreate时启动C;
每个页面均不透明;
04-25 10:14:03.739 6048-6048/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:14:03.749 6048-6048/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:14:03.749 6048-6048/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:14:03.819 6048-6048/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:14:03.849 6048-6048/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:14:03.859 6048-6048/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:14:03.859 6048-6048/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:14:03.929 6048-6048/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:14:03.979 6048-6048/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:14:03.989 6048-6048/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:14:03.989 6048-6048/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:14:04.499 6048-6048/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:14:04.529 6048-6048/com.example.myapplication D/hhhhh: ActivityB onStop
第二种情况:
A—>B—>C
A在onCreate时启动B;
B在onCreate时启动C;
B页面透明;
04-25 10:18:15.249 6636-6636/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:18:15.249 6636-6636/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:18:15.249 6636-6636/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:18:15.299 6636-6636/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:18:15.329 6636-6636/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:18:15.339 6636-6636/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:18:15.339 6636-6636/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:18:15.349 6636-6636/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:18:15.349 6636-6636/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:18:15.389 6636-6636/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:18:15.419 6636-6636/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:18:15.419 6636-6636/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:18:15.419 6636-6636/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:18:15.879 6636-6636/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:18:15.879 6636-6636/com.example.myapplication D/hhhhh: ActivityB onStop
奇怪这里为啥多调用了一次onPause和onResume,而且只出现了一次, 不是必现。
或者
04-25 10:20:48.669 7005-7005/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:20:48.679 7005-7005/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:20:48.679 7005-7005/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:20:48.719 7005-7005/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:20:48.749 7005-7005/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:20:48.759 7005-7005/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:20:48.759 7005-7005/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:20:48.799 7005-7005/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:20:48.829 7005-7005/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:20:48.839 7005-7005/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:20:48.839 7005-7005/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:20:49.269 7005-7005/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:20:49.269 7005-7005/com.example.myapplication D/hhhhh: ActivityB onStop
第三种情况:
A—>B—>C
A点击按钮启动B;
B在onCreate时启动C;
B页面不透明;
04-25 10:25:43.179 8324-8324/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:25:43.179 8324-8324/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:25:43.179 8324-8324/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:25:47.289 8324-8324/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:25:47.319 8324-8324/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:25:47.329 8324-8324/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:25:47.329 8324-8324/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:25:47.379 8324-8324/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:25:47.429 8324-8324/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:25:47.439 8324-8324/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:25:47.439 8324-8324/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:25:47.989 8324-8324/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:25:47.999 8324-8324/com.example.myapplication D/hhhhh: ActivityB onStop
第四种情况:
A—>B—>C
A点击按钮启动B;
B在onCreate时启动C;
B页面透明;
04-25 10:27:39.279 8914-8914/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:27:39.279 8914-8914/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:27:39.279 8914-8914/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:27:41.819 8914-8914/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:27:41.859 8914-8914/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:27:41.869 8914-8914/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:27:41.869 8914-8914/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:27:41.919 8914-8914/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:27:41.989 8914-8914/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:27:41.989 8914-8914/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:27:41.989 8914-8914/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:27:42.519 8914-8914/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:27:42.529 8914-8914/com.example.myapplication D/hhhhh: ActivityB onStop
第五种情况:
A—>B—>C
A点击按钮启动B;
B点击按钮启动C;
B页面透明;
04-25 10:22:14.549 7308-7308/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:22:14.549 7308-7308/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:22:14.549 7308-7308/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:22:30.789 7308-7308/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:22:30.839 7308-7308/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:22:30.839 7308-7308/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:22:30.839 7308-7308/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:22:35.529 7308-7308/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:22:35.549 7308-7308/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:22:35.569 7308-7308/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:22:35.579 7308-7308/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:22:35.579 7308-7308/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:22:36.089 7308-7308/com.example.myapplication D/hhhhh: ActivityB onStop
注意:ActivityA onStop是在ActivityC onCreate之前调用的。
第六种情况:
A—>B—>C
A点击按钮启动B;
B点击按钮启动C;
B页面不透明;
04-25 10:24:25.149 7821-7821/com.example.myapplication D/hhhhh: ActivityA onCreate
04-25 10:24:25.149 7821-7821/com.example.myapplication D/hhhhh: ActivityA onStart
04-25 10:24:25.149 7821-7821/com.example.myapplication D/hhhhh: ActivityA onResume
04-25 10:24:30.009 7821-7821/com.example.myapplication D/hhhhh: ActivityA onPause
04-25 10:24:30.049 7821-7821/com.example.myapplication D/hhhhh: ActivityB onCreate
04-25 10:24:30.049 7821-7821/com.example.myapplication D/hhhhh: ActivityB onStart
04-25 10:24:30.049 7821-7821/com.example.myapplication D/hhhhh: ActivityB onResume
04-25 10:24:30.559 7821-7821/com.example.myapplication D/hhhhh: ActivityA onStop
04-25 10:24:36.089 7821-7821/com.example.myapplication D/hhhhh: ActivityB onPause
04-25 10:24:36.119 7821-7821/com.example.myapplication D/hhhhh: ActivityC onCreate
04-25 10:24:36.119 7821-7821/com.example.myapplication D/hhhhh: ActivityC onStart
04-25 10:24:36.119 7821-7821/com.example.myapplication D/hhhhh: ActivityC onResume
04-25 10:24:36.579 7821-7821/com.example.myapplication D/hhhhh: ActivityB onStop
以上是demo运行结果,希望能帮助到大家。
( 2018.04.25 11:21)
暂无评论