Stéphane Piette Stéphane Piette - 18 days ago 4
Android Question

Android - local image in webview

I'm trying to diplay a local image in my webview :

String data = "<body>" + "<img src=\"file:///android_asset/large_image.png\"/></body>";
webview.loadData(data, "text/html", "UTF-8");

This code doesn't display anything, instead of :


This one works, but I need to have complex web page, not just a picture.

Any ideas ?


Load Html file in Webview and put your image in asset folder and read that image file using Html.

        <img src="abc.gif" width="50px" alt="Hello">

Now Load that Html file in Webview