I don't want to send emails
to other users. I only want to open the launching activity
of Email
. I have tried it through different ways but every time send email(compose)
is opening. But i want to open Email
app only nothing else(Sent, outbox, spam, Trash etc).
My code is below
Intent intent = new Intent(Intent.ACTION_SENDTO)
.setData(Uri.parse("mailto:"));
//check if the target app is available or not
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
Again, This code opens the send email to
(compose) option. But i want to open Email
app only nothing else(Sent, outbox, spam, Trash etc).
Use this code to open default Mail Application :
try {
Intent intent = new Intent(Intent.ACTION_MAIN);
intent.addCategory(Intent.CATEGORY_APP_EMAIL);
this.startActivity(intent);
} catch (android.content.ActivityNotFoundException e) {
Toast.makeText(Dashboard.this, "There is no email client installed.", Toast.LENGTH_SHORT).show();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With