如何通过电子邮件从数据库发送图像 [英] How to send an image from a database via mail
本文介绍了如何通过电子邮件从数据库发送图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到的图像inforamtion从数据库字符串,并使用该字符串创建位图图像。
现在我的问题是我怎么通过邮件发送此形象和事也。此图片未存储在SD卡或其他任何地方。
解决方案
- 在存储位图文件系统上的
-
然后使用下述code到该文件附加到电子邮件:
文件f =新的文件(/路径/要/你/ file.png); 乌里U = Uri.fromFile(F); 意图I =新的意图(Intent.ACTION_SEND); i.setType(图像/ PNG); i.putExtra(Intent.EXTRA_STREAM,U); startActivity(Intent.createChooser(我,电子邮件:));
I am getting an image inforamtion as string from a database and by using that string I create a bitmap image.
Now my question is how am I sending this image and matter also via mail. This image is not stored on the sdcard or anywhere else.
解决方案
- Store that bitmap on your filesystem
Then use following code to attach that file to your email:
File F = new File("/path/to/your/file.png"); Uri U = Uri.fromFile(F); Intent i = new Intent(Intent.ACTION_SEND); i.setType("image/png"); i.putExtra(Intent.EXTRA_STREAM, U); startActivity(Intent.createChooser(i,"Email:"));
这篇关于如何通过电子邮件从数据库发送图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文