MainActivity调用ActivityA,然后它接收ActivityA的通知,现在后面的堆栈是[MainActivity,ActivityA],如果单击通知,则当前后备堆栈不应该更改;如果没有单击通知,然后返回到MainActivity,然后再进入ActivityB,后端堆栈现在是[MainActivity,ActivityB],如果现在单击通知,预期的后备堆栈是[MainActivity,ActivityB,ActivityA],但我得到[MainActivity ,ActivityA]而不是。我的代码如下:
Intent backIntent = new Intent(this, MainActivity.class);
Intent intent = new Intent(this, NotificationActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivities(this, 0,
new Intent[] {backIntent, intent}, PendingIntent.FLAG_UPDATE_CURRENT);
我在Back to main activity from notification-created activity中发现了类似的问题,但似乎不适合我。