我正在使用 ActionBarSherlock在与 ShareActionProvider 一起的应用程序中。我正在使用共享 Intent 以与 ActionBarSherlock example 非常相似的方式共享图像。 :
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
一切正常,唯一的问题是我的应用程序还接受共享图像内容(“图像/*”),因此它显示在应用程序列表中。有什么办法吗?
编辑:
这是我的 Intent 过滤器:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
最佳答案
如果我理解你想做什么,基本上,你想动态启用/禁用你的 intent-filters。
我知道你无法直接达到你想要的效果,但你可以通过 PackageManager and setComponentEnabledSetting() 禁用你的 Activity 来获得相同的效果。 .明显地, 如果您的应用中有可能禁用“接收者” Activity 。
关于android - 从 ShareActionProvider 列表中删除 YourSelf,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15552269/