check build version for html text in android
snippet in html

set html text android java

user9556

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
    textView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>", Html.FROM_HTML_MODE_COMPACT));
} else { 
    textView.setText(Html.fromHtml("<h2>Title</h2><br><p>Description here</p>"));
}

check build version for html text in android

user6361

 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));
 }