Reputation: 12649
I got this Bug list activity to report bugs in my apps. There is EditText and the button. I want the button to send email to me with text from EditText. I used some tutorial and came up with this:
private void sendEmail() {
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, "[email protected]");
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText());
BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
However it just opens emmail app with blank addres and subject field. I want them to be filled as above.
Upvotes: 0
Views: 1402
Reputation: 763
emailIntent.setType("plain/text"); and String[]{"[email protected]"}
private void sendEmail() {
final Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("plain/text");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, String[]{"[email protected]"} );
emailIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, "CFM - zgłoszenie");
emailIntent.putExtra(android.content.Intent.EXTRA_TEXT, description.getText());
BugList.this.startActivity(Intent.createChooser(emailIntent, "Send mail..."));
}
Upvotes: 2