Activityライフサイクル(2)これらを理解することで、ライフサイクルを始めることができます.

3291 ワード

2つのインタフェースはそれぞれAActivity、BActivityで、以下の操作を実行した後、AActivityのライフサイクルがどのように変化するかを分析します.
1.AActivityの起動->BActivityの起動->finish BActivityの削除
1)AActivity起動モードはstandard、BActivity起動モードはstandard
2020-06-07 18:05:12.700 9286-9286/com.jack.test V/BaseActivity: AActivity[d621edb] -> onRestart
2020-06-07 18:05:12.702 9286-9286/com.jack.test V/BaseActivity: AActivity[d621edb] -> onStart
2020-06-07 18:05:12.703 9286-9286/com.jack.test V/BaseActivity: AActivity[d621edb] -> onResume

  AActivity[d621edb]: onRestart( ) -> onStart( ) -> onResume( )
2)AActivity起動モードはsingleTask、BActivity起動モードはstandard
2020-06-07 18:13:47.638 12950-12950/com.jack.test V/BaseActivity: AActivity[d621edb] -> onRestart
2020-06-07 18:13:47.639 12950-12950/com.jack.test V/BaseActivity: AActivity[d621edb] -> onStart
2020-06-07 18:13:47.641 12950-12950/com.jack.test V/BaseActivity: AActivity[d621edb] -> onResume

  AActivity[d621edb]: onRestart( ) -> onStart( ) -> onResume( )
 
2.AActivityの起動->AActivityの起動
1)AActivity起動モードはstandard、BActivity起動モードはstandard
2020-06-07 18:05:50.008 10160-10160/com.jack.test V/BaseActivity: AActivity[d621edb] -> onPause
2020-06-07 18:05:50.035 10160-10160/com.jack.test V/BaseActivity: AActivity[cfbdb69] -> onCreate
2020-06-07 18:05:50.063 10160-10160/com.jack.test V/BaseActivity: AActivity[cfbdb69] -> onStart
2020-06-07 18:05:50.064 10160-10160/com.jack.test V/BaseActivity: AActivity[cfbdb69] -> onResume
2020-06-07 18:05:50.390 10160-10160/com.jack.test V/BaseActivity: AActivity[d621edb] -> onStop

  AActivity[cfbdb69]: onCreate( ) -> onStart( ) -> onResume( )
2)AActivity起動モードはsingleTask、BActivity起動モードはstandard
2020-06-07 18:14:44.621 13993-13993/com.jack.test V/BaseActivity: AActivity[d621edb] -> onPause
2020-06-07 18:14:44.622 13993-13993/com.jack.test V/BaseActivity: AActivity[d621edb] -> onNewIntent
2020-06-07 18:14:44.623 13993-13993/com.jack.test V/BaseActivity: AActivity[d621edb] -> onResume

  AActivity[d621edb]: onPause( ) -> onNewIntent( ) -> onResume( )
 
2.AActivityの起動->BActivityの起動->AActivityの起動
1)AActivity起動モードはstandard、BActivity起動モードはstandard
2020-06-07 18:07:56.842 10974-10974/com.jack.test V/BaseActivity: AActivity[cb1a414] -> onCreate
2020-06-07 18:07:56.872 10974-10974/com.jack.test V/BaseActivity: AActivity[cb1a414] -> onStart
2020-06-07 18:07:56.874 10974-10974/com.jack.test V/BaseActivity: AActivity[cb1a414] -> onResume

  AActivity[cb1a414]: onCreate( ) -> onStart( ) -> onResume( )
2)AActivity起動モードはsingleTask、BActivity起動モードはstandard
2020-06-07 18:17:19.835 14813-14813/com.jack.test V/BaseActivity: AActivity[d621edb] -> onNewIntent
2020-06-07 18:17:19.836 14813-14813/com.jack.test V/BaseActivity: AActivity[d621edb] -> onRestart
2020-06-07 18:17:19.837 14813-14813/com.jack.test V/BaseActivity: AActivity[d621edb] -> onStart
2020-06-07 18:17:19.838 14813-14813/com.jack.test V/BaseActivity: AActivity[d621edb] -> onResume

  AActivity[d621edb]: onNewIntent( ) -> onRestart( ) -> onStart( ) -> onResume( )