I need to directly start the compose activity of the default Android email client. I also need to add more than one attachment to the email. Where I can find the component name
Ok, checking the source code of the Android Email system app I finally found it.
String subject = ...
String text = ...
ArrayList attachments = ...
Intent intent = new Intent(Intent.ACTION_SEND_MULTIPLE);
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
intent.putExtra(Intent.EXTRA_TEXT, text);
intent.putParcelableArrayListExtra(Intent.EXTRA_STREAM, attachments);
intent.setClassName("com.android.email", "com.android.email.activity.MessageCompose");
try {
startActivity(intent);
} catch (ActivityNotFoundException anfe) {
anfe.printStackTrace();
}
This seems to work from Android 4.0 to Android 4.3. In Android 4.4 (KitKat) the name of the Activity has changed in com.android.email.activity.ComposeActivityEmail
, but I haven't tested it.