How to show an image through an intent being compatible with different apps(如何通过与不同应用程序兼容的意图显示图像)
问题描述
我正在尝试共享我之前保存在磁盘上的图像,发送 Intent.ACTION_SEND
.问题是我找不到与不同应用程序、官方 Gmail 应用程序和 TweetDeck 兼容的方法.
I'm trying to share an image I have previously saved on disk, sending an Intent.ACTION_SEND
. The problem is that I can't find a way to be compatible with different apps, official Gmail app and TweetDeck in my case.
我要分享的图片包含在一个文件
中:
The image I want to share is contained in a File
:
选项 A) 使用 Uri.fromFile
结果
- Gmail,图片是否附在电子邮件中?否
- Tweetdeck,图片是否添加到推文消息中?是
- Gmail,图片是否附在电子邮件中?是
- Tweetdeck,图片是否添加到推文消息中?否
结果
在这两种情况下,我都这样发送意图:
In both cases I send the intent like this:
那么,还有其他分享图片的选项吗?共享与大多数应用程序兼容的图像的最佳方式是什么?
So, is there any other options to share an image? How is it the best way to share an image being compatible with most apps as possible?
谢谢!
推荐答案
我终于解决了在MediaStore存储图片的问题.我所做的不是使用文件的 URI:
I finally solved the problem storing the image at the MediaStore. Instead of using the URI of the File what I do is:
最后我使用 contentUriFile
:
这篇关于如何通过与不同应用程序兼容的意图显示图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!