I have code in my app which lets the user send an email to the developer. It prepopulated the To field, the Subject field, and the body field. Now when I run, it populates To but ignores the EXTRAs like Subject, Body, and Chooser text. I'm seeing this behavior on two test devices: one running Lollipop (Verizon Samsung Galaxy Note 4) and one running Jelly Bean 4.2.2 (Samsung Fascinate on CM10.1, although I don't know if this has bearing on the issue.
private void sendHelpEmail() {
Intent email = new Intent(Intent.ACTION_SEND, Uri.parse("mailto:"));
// prompts email clients only
email.setType("message/rfc822");
email.putExtra(Intent.EXTRA_EMAIL, new String[] {getString(R.string.about_email)});
email.putExtra(Intent.EXTRA_SUBJECT, getString(R.string.login_help_subject));
email.putExtra(Intent.EXTRA_TEXT, getString(R.string.login_help_body, classButton.text(), Txt_Student.getText().toString()));
try {
// the user can choose the email client
startActivity(Intent.createChooser(email, getString(R.string.login_help_chooser)));
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(mThis, R.string.login_help_error, Toast.LENGTH_LONG).show();
}
}
Why would Subject and Body get ignored when the To email is populated?
Aucun commentaire:
Enregistrer un commentaire