HtmlKt

public final class HtmlKt


Summary

Public methods

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

Returns a Spanned from parsing this string as HTML.

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

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

Public methods

HtmlKt.parseAsHtml

@NonNull
public static final Spanned HtmlKt.parseAsHtml(
    @NonNull String receiver,
    int flags,
    @Nullable Html.ImageGetter imageGetter,
    @Nullable 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.

@Nullable Html.ImageGetter imageGetter

Returns displayable styled text from the provided HTML string.

@Nullable Html.TagHandler tagHandler

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

See also
fromHtml

HtmlKt.toHtml

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

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

See also
toHtml