sel*_*ine 5 android actionbarsherlock android-actionbar shareactionprovider
我在应用程序中使用ActionBarSherlock以及ShareActionProvider.我正在使用共享意图以与ActionBarSherlock示例非常相似的方式共享图像:
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
shareIntent.setType("image/*");
Run Code Online (Sandbox Code Playgroud)
一切正常,唯一的问题是我的应用程序也接受共享图像内容("图像/*"),因此它显示在应用程序列表中.有没有办法解决?
编辑:
这是我的意图过滤器:
<intent-filter>
<action android:name="android.intent.action.SEND"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="image/*"/>
</intent-filter>
Run Code Online (Sandbox Code Playgroud)
如果我理解你想要做什么,基本上,你想动态启用/禁用你的意图过滤器。
到目前为止,我知道您无法直接实现您想要的目标,但您可以通过PackageManager 和 setComponentEnabledSetting()禁用您的活动来获得相同的效果。显然,如果您的应用程序可以禁用“接收器”活动。
| 归档时间: |
|
| 查看次数: |
303 次 |
| 最近记录: |