Pinki
Pinki

Reputation: 21929

How to send an image from a database via mail

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.

Upvotes: 2

Views: 819

Answers (1)

chikka.anddev
chikka.anddev

Reputation: 9629

  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:"));
    

Upvotes: 1

Related Questions