Skip to content

Instantly share code, notes, and snippets.

@Turskyi
Last active July 24, 2021 10:27
Show Gist options
  • Save Turskyi/14793a83f4bb7f9b8933f878b12c18cb to your computer and use it in GitHub Desktop.
Save Turskyi/14793a83f4bb7f9b8933f878b12c18cb to your computer and use it in GitHub Desktop.
Convenient Spanned extensions for kotlin
fun Spanned.toHtml(): String = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
Html.toHtml( this, Html.FROM_HTML_MODE_LEGACY)
} else {
@Suppress("DEPRECATION")
Html.toHtml(this)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment