Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: Share Bitmap Not Saved To SD

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

like image 762
Chris Avatar asked Jan 26 '12 12:01

Chris


People also ask

How do I share photos without saving?

In fact sharing an image without saving it is by using cache memory. Consequently we can share it like an uri. On the other hand we can simply store the image in cache and use the uri for sharing. Furthermore we are saving bitmap to cache and use it for sharing.


1 Answers

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

like image 51
Chris Avatar answered Oct 28 '22 21:10

Chris