如何发送图像而不存储在 SD 卡中?
我正在开发一个显示图像的应用程序。该应用程序提供了将图像作为附件通过电子邮件发送的选项。我必须将图像保存到 SD 卡才能将图像作为附件通过电子邮件发送。
是否可以将图像作为附件通过电子邮件发送,而不先将其写入 SD 卡?
I am developing an application that displays images. The application provides an option to email the image as an attachment. I have to save the image to the SD card in order to email the image as an attachment.
Is it possible to email the image as an attachment without writing it to the SD card first?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
@西瓦拉杰
例如,如果您将图像存储在手机中的任何位置(甚至在私人文件夹中)
如果您根本不想将其存储在 openFile 方法中,只需修改它即可。
使用正确的权限属性在清单中注册您的提供者,就是这样!
@sivaraj
For example, if you store you image anywhere in the phone (even in a private folder)
Just modify it if you don't want to store it at all in the openFile method.
Register your provider in your manifest with the right authorities attribute and that's it !
您必须为您的图像创建一个 ContentProvider
You have to create a ContentProvider for your images
AFAIK,写入 SDCard 拳头是唯一的方法......并且这是必要的,因为邮件客户端必须能够读取该文件;因此,它必须存放在公共场所。
AFAIK, writting to the SDCard fist is the only way to do it... and it's necessary since the mail client has to be able to read the file; so, it has to be stored on a public place.