title: Sending multiple attachement in email: android.intent.extra.STREAM expected Parcelable
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/4552831/how-to-attach-multiple-files-to-email-client-in-android">how to attach multiple files to email client in android.</a>  </p>
  </blockquote>
  
  
  
  <p>Hello,</p>
  
  <p>I fail to send an email with multiple attachment.</p>
  
  <p>Here is the code I found from web and tutorials:</p>
  
  <pre><code>String[] mArray = getResources().getStringArray(R.array.pdf_entries);               
  int i = 0;
  Intent theIntent = new Intent(Intent.ACTION_SEND_MULTIPLE);
  theIntent.setType("application/pdf");
  
  ArrayList&lt;Uri&gt; uris = new ArrayList&lt;Uri&gt;();
  
  for (String file : mArray) {
      if (booleans[i]) {
          File fileIn = new File("/sdcard/mydir/"+file+".pdf");
          Uri u = Uri.fromFile(fileIn);
          Log.i("","** add: "+u);
          uris.add(u);
      }
      i++;
  }
  theIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
  startActivity(Intent.createChooser(theIntent,"Select email application."));
  </code></pre>
  
  <p>But I always get this error:</p>
  
  <pre><code>04-19 20:25:03.340: WARN/Bundle(5826): Key android.intent.extra.STREAM expected Parcelable but value was a java.util.ArrayList.  The default value &lt;null&gt; was returned.
  04-19 20:25:03.356: WARN/Bundle(5826): Attempt to cast generated internal exception:
  04-19 20:25:03.356: WARN/Bundle(5826): java.lang.ClassCastException: java.util.ArrayList
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.os.Bundle.getParcelable(Bundle.java:1106)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.content.Intent.getParcelableExtra(Intent.java:3396)
  04-19 20:25:03.356: WARN/Bundle(5826):     at com.android.email.activity.MessageCompose.initFromIntent(MessageCompose.java:1306)
  04-19 20:25:03.356: WARN/Bundle(5826):     at com.android.email.activity.MessageCompose.onCreate(MessageCompose.java:334)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.ActivityThread.access$2300(ActivityThread.java:125)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.os.Handler.dispatchMessage(Handler.java:99)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.os.Looper.loop(Looper.java:123)
  04-19 20:25:03.356: WARN/Bundle(5826):     at android.app.ActivityThread.main(ActivityThread.java:4627)
  04-19 20:25:03.356: WARN/Bundle(5826):     at java.lang.reflect.Method.invokeNative(Native Method)
  04-19 20:25:03.356: WARN/Bundle(5826):     at java.lang.reflect.Method.invoke(Method.java:521)
  04-19 20:25:03.356: WARN/Bundle(5826):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
  04-19 20:25:03.356: WARN/Bundle(5826):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
  04-19 20:25:03.356: WARN/Bundle(5826):     at dalvik.system.NativeStart.main(Native Method)
  04-19 20:25:03.403: INFO/SurfaceFlinger(1305): 
  </code></pre>
  
  <p>Thank a lot for any suggestion/tutorial.</p>