I am currently writing an app with a simple form that when you click submit, an e-mail is opened and the data entered into the textviews is automatically populated into the message body.
protected void sendEmail() {
EditText nameField = (EditText) findViewById(R.id.nameField);
String nameValue = nameField.getText().toString();
EditText dateField = (EditText) findViewById(R.id.dateField);
String dateValue = dateField.getText().toString();
EditText ahsField = (EditText) findViewById(R.id.ahsField);
String ahsValue = ahsField.getText().toString();
Log.i("Send email", "");
String[] TO = {""};
Intent emailIntent = new Intent(Intent.ACTION_SEND);
emailIntent.setData(Uri.parse("mailto:"));
emailIntent.setType("text/plain");
emailIntent.putExtra(Intent.EXTRA_EMAIL, TO);
emailIntent.putExtra(Intent.EXTRA_SUBJECT, "Your subject...");
emailIntent.putExtra(Intent.EXTRA_TEXT, "MESSAGE BODY HERE?");
try {
startActivity(Intent.createChooser(emailIntent, "Send mail..."));
finish();
Log.i("Finished sending email", "");
} catch (android.content.ActivityNotFoundException ex) {
Toast.makeText(DDActivity.this, "There is no email client installed", Toast.LENGTH_SHORT).show();
}
}
This is what i have so far, any help would be greatly appreciated!