Getting couldn't send attachment error while attaching images with Gmail app

2.4k views Asked by At

I have a file path of images which was taken from the Gallery and I am adding each file path in to ArrayList. Everything works fine and even I could see the attachments in Gmail. But once if I try to send the images. I am getting couldn't send attachments error. Please help me to resolve this issue. I am completely stuck up with the solutions. Thanks in advance.

The path of a image is something like /storage/emulated/0/myfolder/1433917106851_fact_2.jpg

                Intent intent = new Intent();
                intent.setAction(Intent.ACTION_SEND_MULTIPLE);
                intent.putExtra(Intent.EXTRA_SUBJECT, "Here are some files.");
                intent.setType("image/jpeg"); /* This example is sharing jpeg images. */
                intent.putParcelableArrayListExtra (Intent.EXTRA_STREAM, mShareImages);  //<=== This is the arraylist of images path. 
                startActivity(intent);

Note: mShareImages is a ArrayList<Uri>. I am converting ArrayList<String> to ArrayList<Uri> by using

Uri uri = Uri.Parse(string);

Finally adding this uri object into ArrayList by

mShareImages.add(uri);
2

There are 2 answers

1
user2788843 On

You should put list of the Uri into intent extras, not list of String

0
Dominic D'Souza On

mShareImages needs to be a ArrayList of type Uri and not String.