Tag Archives: html

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(R.id.txtTheLink); // Grab our textview/whatever with the HTML
txtTheLink.setText(Html.fromHtml("<a href=\"https://www.vooba.net\">Go to Vooba!</a>")); // Convert from HTML to remove the HTML tag>
txtLinks.setMovementMethod(LinkMovementMethod.getInstance()); // Activate the link

Hope this helps!