I'm sending a Retrofit GET request to the API which returns a single JSON object with entire HTML page inside this object written as a String. How do I display that inside an Android app? What's the go-to practice for this example? WebView or something else?
Asked
Active
Viewed 870 times
-1
-
Theres a webView.loadString (or similar) that I dont remember exactly – Marcos Vasconcelos Feb 07 '18 at 19:01
-
1If you want only to show HTML formatted text, the HTML.from(stringText) returns a Spannable that can be set as the text of a TextView – Marcos Vasconcelos Feb 07 '18 at 19:01
-
loadData did the job right. But there's another issue now. The HTML has links in it, most notable a link that says back on it, but it's obviously an http link, rather than an Android View link, so clicking that takes me back to browser. I don't suppose there's any solution for that? – Derrick Feb 07 '18 at 19:26
-
You can use WebView or use something like HtmlTextView, wich fetches data from html and trasform it to Spannable https://github.com/PrivacyApps/html-textview – Jarik Eng Feb 07 '18 at 19:45
-
Ok, thanks, I'll look into it. – Derrick Feb 07 '18 at 20:02