I have activity with image and share button, image obtained from DB
I want to save the image first and then share it
everything is going well, the image is saved in the internal memory and it is going to share, but when another application is launched (for example, whatsapp or messaging), it says that the file does not support
I have another image for ddms manually, and then sharing works without problems! Oo
I think the problem is saving the bitmap, even I checked the saved bitmap from ddms and it looked good
there are my codes:
save
try {
FileOutputStream out = new FileOutputStream(new File(getFilesDir(), "temp.png"));
imageview.setImageBitmap(b1);
b1.compress(Bitmap.CompressFormat.PNG, 100, out);
out.flush();
out.close();
}
catch (Exception e) {}
general method
private void initShareIntent(String type,String _text)
{
Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.fromFile(new File(getFilesDir(), "temp.png")));
shareIntent.setType("image/PNG");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "send"));
}
source
share