Home > Back-end >  How to remove html tags in Android Jetpack Compose?
How to remove html tags in Android Jetpack Compose?

Time:09-06

So I retrieved my data from API (spoonacular API), but the text concluded with HTML tags when I displayed it on my screen.

for example:

Crockpot "Refried" Beans is a <b.>gluten free and vegan</.b>......

Any suggestions on how can I get rid of that issue?

CodePudding user response:

Never mind, I found the solution but I don't know if it's a good or bad solution.

So, import the Jsoup library in your gradle file

implementation 'org.jsoup:jsoup:1.15.3'

and write this code below

fun parseHtml(description: String): String{
    return Jsoup.parse(description).text()
}

If it's bad please let me know, thanks!

  • Related