Send user to an email app

Asked

Viewed 78 times

0

I want to send the user to an email application, but I just want to set the recipient, the rest the user himself will fill in the application he chose and then send

Has as?

1 answer

0


You can use this code below:

Intent emailIntent = new Intent(android.content.Intent.ACTION_SEND);
emailIntent.setType("text/plain");
emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String\[\]{  "[email protected]"});           
emailIntent.setType("message/rfc822");

try {
    startActivity(Intent.createChooser(emailIntent, "Escolha o App desejado..."));
} catch (android.content.ActivityNotFoundException ex) {
    Toast.makeText(getActivity(), "Não há programas de email instalados.", Toast.LENGTH_SHORT).show();
}

This way the user will be able to choose the desired APP for sending the email, and will already open the APP with the email address filled

  • I work the way I wanted, thanks

  • Could you help me with one more thing? The code works perfectly so it would be possible to have an option that defines a standard application?

Browser other questions tagged

You are not signed in. Login or sign up in order to post.