This is a very simple issue. I'm trying to put a link to an email address in a TextView, using Html.fromHtml.
body.setText(Html.fromHtml("<a href=\"mailto:emailaddress+subaddress@gmail.com\">开发者_高级运维Contact</a>"));
When that link is clicked, a new email is addressed to "emailaddress subaddress@gmail.com". Notice that the plus symbol has disappeared. I've tried this:
body.setText(Html.fromHtml("<a href=\"mailto:emailaddress"+'+'+"subaddress@gmail.com\">Contact</a>"));
and
body.setText(Html.fromHtml("<a href=\"mailto:emailaddress+subaddress@gmail.com\">Contact</a>"));
to the same result.
Anyone know how I can get the link to work correctly?
A +
sign is one URL-encoded form of a space (the other is %20
). To encode a literal +
sign in a URL, you need to escape it in the same way - in this case as %2B
精彩评论