views:

36

answers:

1
I have parse the url and i get the html contents i want to show that content as a web page then what can i do to show that html contents. I am using textView then it shows same html content with tags. 



I have following html content which i want to display in webView. It displays only

**//  Please** but its original output is not this.

<br /><br />Read the handouts please for tomorrow.<br /><br /><!--
homework help
homework help
help with homework
homework assignments
elementary school
high school
middle school
// --><font color="#60c000" size="4"><strong>Please!</strong></font>


its original output is 

Read the handouts please for tomorrow.

Please!

I have other html also where there is a tag of img but this shows nothing

Please Suggest me how to solve this problem

A: 

There are two ways. Either go for a webview which can encode HTML tags automatically or if you want to use Textview you can use Html.fromHtml() method available on Android....Then set the Text to your Textview. Something like this

Textview.setText(Html.fromHtml(source));

or Even like this

Spanned t=Html.fromHtml("HTML String that needs to be displayed");
yourtextView.setText(t);
Rahul