Java – Android: Share Bitmap Not Saved To SD

androidbitmapjava

I have an app that takes a screenshot and the shares this with the share intent. Rather than save multiple images each time a user wants to simply share the image. Below is the code I used for images saved to the SD

Intent share = new Intent(Intent.ACTION_SEND);
share.setType("image/png");

dir = "file://" + Environment.getExternalStorageDirectory().getAbsolutePath() + File.separator + "Folder/" + location;
share.putExtra(Intent.EXTRA_STREAM, Uri.parse(dir));

startActivity(Intent.createChooser(share, "Share Image"));

However I cant figure out how to simply save a Bitmap such as…

share.putExtra(Intent.EXTRA_STREAM, theBitmap);

Is there a way to do this without saving the image?

Thanks

Best Answer

What I eneded up doing was saving one "Temp" image to the SD/Phone and just overwrite the each time.