Skip to main content
Inspiring
Jul 18, 2014 7:52 PM UTC
Answered

Attach multiple files to email via ane

Hello. I`m trying to improve my ane and add multiple attachements to email.

This is my latest try: gist:1fcc08159e4cb724bbf2

Problem in this code:

if(filesPaths!=""){

   String[] filesPathsArray = filesPaths.split(",");

   ArrayList<Uri> uris = new ArrayList<Uri>();

   for (String filePath:filesPathsArray) {

      Uri uri = Uri.parse("file://" + filePath);

      uris.add(uri);

   }

   emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);

}


I have message "Couldn`t attach files".


But i know my array is correct. When i`m trying to add single file, it works ok:


emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file://"+ filesPathsArray [0]));

What i`m doing wrong? How to correct attach multiple files?

This topic is closed to new replies. Start a new post to keep the conversation going.
illuzorCorrect answer
Inspiring
Sep 10, 2014 5:28 PM UTC

Ok. I realized how to solve the problem.

Necessary to use Intent.ACTION_SEND_MULTIPLE instead of Intent.ACTION_SEND.

1 reply

illuzorAuthorCorrect answer
Inspiring
Sep 10, 2014 5:28 PM UTC

Ok. I realized how to solve the problem.

Necessary to use Intent.ACTION_SEND_MULTIPLE instead of Intent.ACTION_SEND.

Translate