更新时间:2023-12-03 21:23:22
要由D回来给A,使用意向的标志。
To Come Back from D to A, use Intent Flags.
Intent intent = new Intent(activity, activityToStart);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)
startActivity(intent);
FLAG_ACTIVITY_CLEAR_TOP,会而不是创建新的活动,它会调用堆栈上的活动,并会弹出所有的活动在被调用的活动。
FLAG_ACTIVITY_CLEAR_TOP, will instead of creating new activity, it will invoke the activity on the stack, and will pop all the activities over the activity being invoked.