Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download and display html files

I have to download contents of an HTML file (which uses image) via REST API. Then store them for offline use. When needed I want to display the HTML page with a WebView (of course with image). The REST result should look something like:

{
"id": 45,
"html": "<!DOCTYPE html><html><body><h1>My Heading</h1><p>My paragraph.</p><img src='abc.com/images/54289847.jpg' alt='any' width='104' height='142'></body></html>",
"imagePath": "abc.com/images/54289847.jpg",
"moreData": "something more"
}

So, what will be the most efficient way to do this?

I'm planning encrypted contents of HTML will go to local storage in any file. Same thing for the images. And then decrypt, and load to WebView. But will it work for images?

I don't need any code, just suggest me a way.

like image 992
A. K. M. Tariqul Islam Avatar asked Dec 22 '25 03:12

A. K. M. Tariqul Islam


1 Answers

in this example string is loaded to webview

String summary = "You scored 192 points."; webview.loadData(summary, "text/html", null);

what if you get string from input stream and pass it to web view IOUtils.toString(context.getResources().openRawResource())

like image 179
Konstantin Volkov Avatar answered Dec 23 '25 19:12

Konstantin Volkov