0
Excute code
Intent intent = getFirstIntent(context);
context.startActivity(intent);
intent = getSecondIntent(context);
context.startActivity(intent);
private void Intent getFirstIntent(Context context){
Intent intent = new Intent(context, FirstActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
private void Intent getSecondIntent(Context context){
Intent intent = new Intent(context, SecondActivity.class);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_SINGLE_TOP);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
return intent;
}
我添加日誌活動週期(的onCreate,的onDestroy)爲什麼第一個被調用的活動沒有運行?
下面登錄
SecondActivity的onCreate>返回鍵>的onDestroy> FirstActivity的onCreate>返回鍵> onDestory
但我希望這個過程
FirstActivity onCreate> SecondActivity> onCreate>返回鍵> onDestory> FirstActivity(onResume)>返回鍵> onDestory
爲什麼先調用SecondActivity-onCreate?我想打電話給FirstActivity-的onCreate