Build 1.0_r1(from source)

android.text
Class Html

java.lang.Object
  extended by android.text.Html

public class Html
extends Object

This class processes HTML strings into displayable styled text. Not all HTML tags are supported.


Nested Class Summary
static interface Html.ImageGetter
          Retrieves images for HTML <img> tags.
static interface Html.TagHandler
          Is notified when HTML tags are encountered that the parser does not know how to interpret.
 
Method Summary
static Spanned fromHtml(String source)
          Returns displayable styled text from the provided HTML string.
static Spanned fromHtml(String source, Html.ImageGetter imageGetter, Html.TagHandler tagHandler)
          Returns displayable styled text from the provided HTML string.
static String toHtml(Spanned text)
          Returns an HTML representation of the provided Spanned text.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

fromHtml

public static Spanned fromHtml(String source)
Returns displayable styled text from the provided HTML string. Any <img> tags in the HTML will display as a generic replacement image which your program can then go through and replace with real images.

This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.


fromHtml

public static Spanned fromHtml(String source,
                               Html.ImageGetter imageGetter,
                               Html.TagHandler tagHandler)
Returns displayable styled text from the provided HTML string. Any <img> tags in the HTML will use the specified ImageGetter to request a representation of the image (use null if you don't want this) and the specified TagHandler to handle unknown tags (specify null if you don't want this).

This uses TagSoup to handle real HTML, including all of the brokenness found in the wild.


toHtml

public static String toHtml(Spanned text)
Returns an HTML representation of the provided Spanned text.


Build 1.0_r1(from source)

Please submit a feedback, bug or feature