How to send an image from a database via mail

空扰寡人 提交于 2019-12-06 10:14:55

问题


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.


回答1:


  1. Store that bitmap on your filesystem
  2. 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:"));
    


来源:https://stackoverflow.com/questions/4759057/how-to-send-an-image-from-a-database-via-mail

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!