I want to share Image via shareIntent
. My code is given below :
Intent shareIntent = new Intent(Intent.ACTION_SEND);
shareIntent.setType("image/*");
shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(list.get(position).getFilePath()));
shareIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "Sending from myApp");//gmail-subject
shareIntent.putExtra(android.content.Intent.EXTRA_TEXT, "Image 1234");//gmail-body
shareIntent.putExtra(Intent.EXTRA_TITLE, "Image 1234");
shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(shareIntent, "Share via"));
I am able to send image in WhatsApp and Facebook but not in Gmail or Instagram.
When trying to share via Gmail it shows me
Can't attach file
and for Instagram it shows me
Unable to load image
.
Is anything else required to add in shareIntent
?