Quantcast
Channel: Is it possibile to use extension functions in databinding? - Stack Overflow
Viewing all articles
Browse latest Browse all 3

Is it possibile to use extension functions in databinding?

$
0
0

I want to htmlize some data and set in the text view via data binding? Is it possible?

ie.If i have an extension function like this

 fun TextView.htmlText(txt: String?) {txt.let {    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {        Html.fromHtml(txt, Html.FROM_HTML_MODE_COMPACT)    } else {        Html.fromHtml(txt)    }}

}

how can i put this extension function in databinding instead of thisandroid:text="@{model.text}"


Viewing all articles
Browse latest Browse all 3

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>