You can only do such a thing if our image is inside your /assets
folder. Also, you must load your html with a baseUrl that’s inside your assets folder.
You can use WebView.loadUrl()
or WebView.loadDataWithBaseURL()
:
webView.loadUrl(“file:///android_asset/file.html”);
or
webView.loadDataWithBaseURL("file:///android_asset/", "<img src="https://stackoverflow.com/questions/4534043/file.jpg" />", "text/html", "utf-8", null);
(file.jpg should be inside your assets folder)