1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| protected void sendEmail() {
String[] recipients = {recipient.getText().toString()};
Intent email = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
// prompts email clients only
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL, recipients);
email.putExtra(Intent.EXTRA_SUBJECT, subject.getText().toString());
email.putExtra(Intent.EXTRA_TEXT, body.getText().toString());
email.putExtra(Intent.EXTRA_STREAM, "file:///sdcard/droidText/sample.pdf");
try {
// the user can choose the email client
startActivity(Intent.createChooser(email, "Choose an email client from..."));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(CreerCV.this, "No email client installed.",
Toast.LENGTH_LONG).show();
} |
Partager