maybe an easy question: I want to share a bitmap I received over the net to twitter/facebook/etc with the default share "intent".
The code I found
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("image/jpeg");
sendIntent.putExtra(Intent.EXTRA_STREAM, "IDONTKNOW");
sendIntent.putExtra(Intent.EXTRA_TEXT,
"See my captured picture - wow :)");
startActivity(Intent.createChooser(sendIntent, "share"));
needs to be filled at the point "IDONTKNOW" with the bitmap. (this.bitmap)
I found no way to handle this without saving the bitmap to internal sd..
regards
Simply, you can convert a bitmap into PNG from external storage.
File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
File imageFile = new File(path, getCurrentTime()+ ".png");
FileOutputStream fileOutPutStream = new FileOutputStream(imageFile);
bitmap.compress(Bitmap.CompressFormat.PNG, 80, fileOutPutStream);
fileOutPutStream.flush();
fileOutPutStream.close();
Then, you can get a URI through Uri.parse:
return Uri.parse("file://" + imageFile.getAbsolutePath());
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With