HtmlKt

Added in 1.1.0

public final class HtmlKt


Summary

Public methods

static final @NonNull Spanned
parseAsHtml(
    @NonNull String receiver,
    int flags,
    Html.ImageGetter imageGetter,
    Html.TagHandler tagHandler
)

Returns a Spanned from parsing this string as HTML.

static final @NonNull String
toHtml(@NonNull Spanned receiver, int option)

Returns a string of HTML from the spans in this Spanned.

Public methods

parseAsHtml

public static final @NonNull Spanned parseAsHtml(
    @NonNull String receiver,
    int flags,
    Html.ImageGetter imageGetter,
    Html.TagHandler tagHandler
)

Returns a Spanned from parsing this string as HTML.

Parameters
int flags

Additional option to set the behavior of the HTML parsing. Default is set to Html.FROM_HTML_MODE_LEGACY which was introduced in API 24.

Html.ImageGetter imageGetter

Returns displayable styled text from the provided HTML string.

Html.TagHandler tagHandler

Notified when HTML tags are encountered a tag the parser does not know how to interpret.

See also
fromHtml

toHtml

public static final @NonNull String toHtml(@NonNull Spanned receiver, int option)

Returns a string of HTML from the spans in this Spanned.

See also
toHtml