Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "My text");
sendIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(http://onman.ir/colorfinder/sample.jpg));
sendIntent.setType("*/*");
sendIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
startActivity(Intent.createChooser(sendIntent, "Share using"));
This code is not able to attach image when sharing intent with Gmail
, also it is giving error when sharing with Facebook
that share multiple image or a video only. When I change type with sendIntent.setType("image/*")
then it is opening the share window of Facebook
but with blank text and image.