I want to Share the image in image view.but i don\'t want save to SDcard. But when i use Intent to share i used code
Intent share = new Intent(Intent.ACTION_
I was able to do this:
File file = new File( getCacheDir(), "screenshot.png");
...
file.setReadable(true, false);
Uri uri = Uri.fromFile(file);
...
intent.putExtra(Intent.EXTRA_STREAM, uri);
This way I save the file in my own cache folder, so I'm not fooling with any public folders or depending on the sd card being present.
Also, this way it gets deleted automatically if the user removes my app, but I also used startActivityForResult/onActivityResult to delete the file and set its folder back to private when the share is finished.
(Personally I was hoping to find a way to share a bitstream and avoid the step of creating a file entirely, but I don't think that is possible.)
[EDIT: I discovered this doesn't work on 2.3.6 where the file MUST be on file:///mnt/sdcard.]