如何从Activity.startActivity(意向)选配排除我自己的活动?自己的、意向、Activity、startActivity

2023-09-12 05:09:37 作者:陌泪

我的应用程序的工作原理与图片。它可以把多张照片作为输入,对其进行处理,并重新发送到另一个应用程序。

My app works with pictures. It can take multiple pictures as an input, process them, and send them again to another app.

因此​​,我的主要活动已宣布对 ACTION_SEND_MULTIPLE 的意图过滤器图片/ * MIME类型,并可能导致在执行新的意图用相同的操作和数据类型使用 Activity.startActivity(意图)

As a consequence, my main Activity has declared an intent filter on ACTION_SEND_MULTIPLE for image/* mimetypes and can result in issuing a new Intent with the same action and data type using Activity.startActivity(Intent).

有没有办法排除从被后显示给用户的应用程序的列表中,我自己的活动 startActivity()打电话?

Is there a way to exclude my own activity from the list of apps that is displayed to the user after the startActivity() call ?

推荐答案

不是直接的,AFAIK。但是,您可以通过创建自己的选择器 PackageManager queryIntentActivityOptions(),这确实允许过滤自己(或其他事情)了。

Not directly, AFAIK. However, you could create your own chooser using PackageManager and queryIntentActivityOptions(), which does allow for filtering yourself (or other things) out.