Example usage for android.text Html fromHtml

List of usage examples for android.text Html fromHtml

Introduction

In this page you can find the example usage for android.text Html fromHtml.

Prototype

public static Spanned fromHtml(String source, int flags) 

Source Link

Document

Returns displayable styled text from the provided HTML string.

Usage

From source file:com.gammalabs.wifianalyzer.MainActivity.java

@SuppressWarnings("deprecation")
@NonNull// www  . j  a va 2 s  .com
Spanned fromHtml(@NonNull String subtitleText) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        return Html.fromHtml(subtitleText, Html.FROM_HTML_MODE_LEGACY);
    }
    return Html.fromHtml(subtitleText);
}

From source file:com.adkdevelopment.earthquakesurvival.utils.Utilities.java

/**
 * Makes text version of an html string.
 *
 * @param input informatted html text./*from  ww  w  . j  a v a  2s  .c o m*/
 * @return only formatted text from html input.
 */
public static Spanned getHtmlText(String input) {
    Spanned result;

    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
        result = Html.fromHtml(input, Html.FROM_HTML_MODE_LEGACY);
    } else {
        //noinspection deprecation
        result = Html.fromHtml(input);
    }

    return result;
}