how to get a value as htmltext on textview in android? [duplicate]

Possible Duplicate:
How to display HTML in TextView?

I have a string that contains some tags(<p>,<img>,etc).

Tell how to handle these tags in textview.

Thanks in advance.


Asked by: Melissa182 | Posted: 20-01-2022






Answer 1

textView.setText(Html.fromHtml("<p>" + title + "</p>");

you can also user web view

WebView webview = new WebView(this);
 setContentView(webview);

 // Simplest usage: note that an exception will NOT be thrown
 // if there is an error loading this page (see below).
 webview.loadUrl("http://slashdot.org/");

 // Of course you can also load from any string:
 String summary = "<html><body>You scored <b>192 points.</body></html>";
 webview.loadData(summary, "text/html", "utf-8");

http://developer.android.com/reference/android/webkit/WebView.html

Answered by: Sawyer793 | Posted: 21-02-2022



Similar questions

Htmltext in android listview

i want to add a multicolor (maybe html) text to a clickable android listview. For example: test Is that possible?


html - Android Line Break on htmlText

I'm trying to create an item description in a form of a list. Example: Medium 100% Cotton Etc This description is sotred in my database, text as a data type. The problem : Im gettin all de...






Still can't find your answer? Check out these communities...



Android Google Support | Android Community | Android Community (Facebook) | Dev.io Android



top