开发者

Android Mimic Auto-Link Intent for Email- Missing Address

开发者 https://www.devze.com 2023-01-25 05:09 出处:网络
I was wondering how I can mimic the action that occurs on an auto-linked email address via an intent.I tried using this method, Messaging and email intents in Android? and ran in on my phone and in my

I was wondering how I can mimic the action that occurs on an auto-linked email address via an intent. I tried using this method, Messaging and email intents in Android? and ran in on my phone and in my emulator and the message window opened but did not have the email address. And the composer window for the auto-link looks different than the composer for the following code. Any ideas?

Here is the code from the link above so you dont have to click:

Intent emailIntent = new Intent(android.content.Intent.ACTI开发者_JS百科ON_SEND);

emailIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String[] {"foo@bar.com"});

emailIntent.setType("text/plain");
startActivity(Intent.createChooser(emailIntent, "Send a mail ..."));


You do not have a subject or body, which may be confusing the email client. Also, unless you specifically want the user to have to choose their mail client, skip the createChooser() and just call startActivity(emailIntent), as that will bring up their default client. See here for a blog post with more samples.

0

精彩评论

暂无评论...
验证码 换一张
取 消