views:

22

answers:

0

I'm attempting to programmatically create an email with, potentially, multiple attachments but have run into some difficulty. I consulted this similar question and found that the answer was do create something like this:

ArrayList<Uri> uris = new ArrayList<Uri>();
for (String file : filePaths)
{
    File fileIn = new File(file);
    Uri u = Uri.fromFile(fileIn);
    uris.add(u);
}
emailIntent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris);
context.startActivity(Intent.createChooser(emailIntent, "Send mail..."));

This solution seemed to yield mixed results for people, some claiming that it always worked for them and some, including me, getting an exception like this: ClassCastException... putParcelableArrayListExtra requires a parcelable not an ArrayList.

Does anyone know if this is a limitation of a particular Android version? I'm using 1.6 right now, unfortunately, and I suspect that might be the source of the problem but I haven't been able to confirm this.

Thanks in advance