0

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.

Prof. Falken
  • 24,226
  • 19
  • 100
  • 173
Jacek Kwiecień
  • 12,397
  • 20
  • 85
  • 157

1 Answers1

2

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..."));
    }
Jacek Kwiecień
  • 12,397
  • 20
  • 85
  • 157