How to open the email application from my app. I want to launch directly the compose email screen with the email id that the user should email to. I want to do something similar to开发者_Python百科 what happens on a pc. If you click on an email address, system will automatically opens the email client with the compose screen. The compose screen will ofcourse contain the email id.
I know this is an old question, but it was the first hit in Google and it took me some more digging to find the most straightforward solution.
Intent intent = Intent.parseUri("mailto:bob@test.com", Intent.URI_INTENT_SCHEME);
startActivity(intent);
Is there a mailto:// handler within Android? That is how it works on the PC, if there is a text mailto://jdoe@joe.bloggs.com, it will trigger the loading of an email client that is set to default as per the user's choice. Good luck in your quest. :)
Take care, Tom.
From poking around in the Contacts application's source code, it looks like you can fire off an Intent that looks something like this:
new Intent(Intent.ACTION_SENDTO,
Uri.fromParts(Constants.SCHEME_MAILTO, "bob@test.com", null)
)
精彩评论