android,一个 Pendingintent 启动多个活动的用例是什么?

android, what would be the use case for one Pendingintent to launch multiple activities?

public static PendingIntent getActivities (Context context, 
                int requestCode, 
                Intent[] intents, 
                int flags)

In the doc ,它表示 intent[] 是“要启动的活动的意图数组”。

好像是用于启动多个activity的情况

想不出通过通知点击打开多个活动的用例。任何人都有显示通过一个 Pendingintent 启动多个活动的示例吗?

startActivities()documentation(这是最终的结果)非常清楚地解释了发生的事情:

Launch multiple new activities. This is generally the same as calling startActivity(android.content.Intent) for the first Intent in the array, that activity during its creation calling startActivity(android.content.Intent) for the second entry, etc. Note that unlike that approach, generally none of the activities except the last in the array will be created at this point, but rather will be created when the user first visits them (due to pressing back from the activity on top).

所以如果你想在应用程序中启动特定的 Activity 并且你想确保正确设置 activity 堆栈,那么当用户按下返回,它将循环返回您设置的活动堆栈。

就我个人而言,我理解他们在这里试图做什么,但我认为这是一个重大失败并且有更好的方法来做到这一点(基本上让您的应用程序足够聪明以了解如何让您回到previous Activity 而不假设它存在于堆栈中)。但这只是我的 un-asked-for 意见。