title: Unable to attach multiple files to an email in Android
body: <p>I want to attach multiple files to an email.</p>
  
  <p>First I am preparing list of <code>Uri</code>'s.</p>
  
  <pre><code>void prepareListOfUri()
  {
      listOfUri = new ArrayList&lt;Uri&gt;();
      File fileTemp = new File(android.os.Environment.getExternalStorageDirectory(), "BuyNowImages");
      fileTemp.mkdirs();
  
      for (int i = 0; i &lt; listOfImageView.size(); i++)
      {
          try
          {
              ByteArrayOutputStream bos = new ByteArrayOutputStream();
              Drawable drawable = listOfImageView.get(i).getDrawable();
              Bitmap bitmapPicked = ((BitmapDrawable) drawable).getBitmap();
              bitmapPicked.compress(CompressFormat.JPEG, 75, bos);
              byte[] image = bos.toByteArray();
              File file = new File(fileTemp, "buynow_product" + i + ".jpg");
              file.createNewFile();
              // write the bytes in file
              FileOutputStream fo = new FileOutputStream(file);
              fo.write(image);
              Uri uri = Uri.parse("file://" + file.getAbsolutePath());
              listOfUri.add(i, uri);
          } catch (Exception e)
          {
              // TODO: handle exception
              e.printStackTrace();
          }
      }
  }
  </code></pre>
  
  <p>And for attaching &amp; sending email</p>
  
  <pre><code>void sendMultipleAttachments()
      {
          try
          {
              Intent intentEmail = new Intent(Intent.ACTION_SEND);
              intentEmail.setType("text/plain");
              String[] recipients = new String[] { "" };
  
              intentEmail.putExtra(Intent.EXTRA_EMAIL, recipients);
              intentEmail.putExtra(Intent.EXTRA_SUBJECT, "subject of email");
              intentEmail.putExtra(Intent.EXTRA_TEXT, "body of email");
              intentEmail.setType("image/jpeg");
              intentEmail.putParcelableArrayListExtra(Intent.EXTRA_STREAM, listOfUri);
              startActivity(intentEmail);
          } catch (android.content.ActivityNotFoundException ex)
          {
              Toast.makeText(this, "There are no email clients installed.", Toast.LENGTH_SHORT).show();
              ex.printStackTrace();
          } catch (Exception e)
          {
              e.printStackTrace();
              Toast.makeText(this, "Exception " + e.getMessage(), Toast.LENGTH_SHORT).show();
          }
      }
  </code></pre>
  
  <p>I have checked the list of <code>Uri</code>'s is prepared perfectly by sending the each file individually. But on sending multiple files by using above code I get following <code>Exception</code>.</p>
  
  <pre><code>Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList.  The default value &lt;null&gt; was returned.
  </code></pre>