Skip to main content
Inspiring
July 18, 2014
Answered

Attach multiple files to email via ane

  • July 18, 2014
  • 1 reply
  • 563 views

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 has been closed for replies.
Correct answer illuzor

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
September 10, 2014

Ok. I realized how to solve the problem.

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