I have one ImageSlider
and i have one button,on Button Click event i want to send an Email with image attach from Imageslider
.
I did code like this but it's not working.
mail.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setType("application/image");
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Hi");
emailIntent.putExtra(Intent.EXTRA_TEXT, "");
String imageFileName = array.get(0).getAsJsonObject().get("images").getAsJsonArray().get(0).getAsJsonObject().get("image").getAsString();
emailIntent.putExtra(Intent.EXTRA_STREAM,Uri.parse(imageFileName));
startActivity(Intent.createChooser(emailIntent, "Email via..."));
}
});
It must show me an image in the email,but it Shows me Toast Message
Unable to Attach File