Just use
if (Build.VERSION.SDK_INT >= 24) {
Html.fromHtml(String, int) // for 24 api and more
} else {
Html.fromHtml(String) // or for older api
}
to use Html.fromHtml(String, int) for 24 api follow documentation:
https://developer.android.com/reference/android/text/Html.html