I want to know is below code correct ?
I have following code which takes user Name, email address, email subject and email body. Then user clicks submit button:
submitButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Intent intent = new Intent(Intent.ACTION_SENDTO);
intent.setType("text/plain");
intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, nameValue); //nameValue is sender name takes via EditText
intent.putExtra(Intent.EXTRA_EMAIL, emailValue); //emailValue is sender email address takes via EditText
intent.putExtra(Intent.EXTRA_SUBJECT, subjectValue); //subjectValue is subject of email takes via EditText
intent.putExtra(Intent.EXTRA_TEXT, messageValue); //mesageValue is body of message takes via EditText
intent.setData(Uri.parse("mailto:example@gmail.com"));
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}
});
I have not android phone to test.
In emulator I am getting error below:

How do I know that above code works fine on phone ??
Because you have no email application installed in your device. Working with this code, you must have email applications installed in your phone.