How to link text in Android

One of the weirdest things I stumbled across was the ability to hyperlink text in the Android environment.  Here is how to hyperlink text and then make it clickable.

TextView txtTheLink = (TextView)findViewById(; // Grab our textview/whatever with the HTML
txtTheLink.setText(Html.fromHtml("<a href=\"\">Go to Vooba!</a>")); // Convert from HTML to remove the HTML tag>
txtLinks.setMovementMethod(LinkMovementMethod.getInstance()); // Activate the link

Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *