render html tag in string android code example

Example 1: set html text android java

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    textView.setText(Html.fromHtml("

Title


Description here

", Html.FROM_HTML_MODE_COMPACT)); } else { textView.setText(Html.fromHtml("

Title


Description here

")); }

Example 2: check build version for html text in android

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
        holder.tvName.setText(Html.fromHtml(list.get(position).name, Html.FROM_HTML_MODE_COMPACT));
 } else {
        holder.tvName.setText(Html.fromHtml(list.get(position).name));
 }

Tags:

Misc Example