dimanche 10 juillet 2016

Email multiple attachments AND prefill email

I do following:

Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_EMAIL, new String[] { receiver });
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, uris); // uris is a array list!

Then I tried adding following:

intent.putExtra(Intent.EXTRA_TEXT, "text");

this adds a log line complaining about that text is not an array list. Works though, but the email has no body

And alternatively i tried following:

ArrayList<String> texts = new ArrayList();
for (int i = 0; i < uris.size(); i++)
    texts.add("Test");
intent.putParcelableArrayListExtra(Intent.EXTRA_TEXT, texts);

This removes the log warning, but the email still has no body.

Question

How can append multiple files to the mail AND prefill the body with some text?

Aucun commentaire:

Enregistrer un commentaire