HTML to TextView

HTML to TextView


You can convert an HTML code (only with text) to TextView by following the steps.

Step 1:
Create a string variable, I'll name it html_string

Step 2:
Set your string value (html_string) to the HTML codes you want to use, e.g.:
<span style="color: #F44336"><b>URL</b></span>: skeshwarecodes.blogspot.com


Step 3:
Add this code after:
textview1.setText(Html.fromHtml(html_string));

textview1.setMovementMethod(android.text.method.LinkMovementMethod.getInstance());

Comments

  1. Where i put html codes? In activity above the second code?

    ReplyDelete

Post a Comment

Popular posts from this blog

Number with Comma (9,999)

Get Percent of the Number (98%)

Get X, Y Position of Layout