android - 从 ShareActionProvider 列表中删除 YourSelf

标签 android android-actionbar actionbarsherlock shareactionprovider

我正在使用 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/

相关文章:

java - 使用 switch 语句处理 fragment 中的 onBackPressed()

android - 如何让我的 Android TODO 显示在 Eclipse 的任务中?

android - 我们如何从可下载的字体创建字体?

android - 使用 navigateUpFromSameTask() 从 Activity 返回

android - Material 按钮图标显示没有颜色

android - 当 ShapeDrawable 设置为图标时,ActionBar 项目不显示

android - 将我的 ActionBar 放在底部

android - fragment MyFragment 未附加到 Activity

android - ActionBarSherlock中设置Home应用程序图标的方法

android - 使用 ActionBarsherlock 时更改应用程序标签字体