tags:

views:

29

answers:

1

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:[email protected]\">Contact</a>"));

When that link is clicked, a new email is addressed to "emailaddress [email protected]". Notice that the plus symbol has disappeared. I've tried this:

body.setText(Html.fromHtml("<a href=\"mailto:emailaddress"+'+'+"[email protected]\">Contact</a>"));

and

body.setText(Html.fromHtml("<a href=\"mailto:emailaddress&#43;[email protected]\">Contact</a>"));

to the same result.

Anyone know how I can get the link to work correctly?

+1  A: 

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

Gareth
Well, I feel stupid. :P Totally forgot about that. Thanks a ton.
Crazydog