Webview wv=(WebView)findViewById(R.id.webview1);
``String str="<html>
<body>
<img src='file:///android_asset/nag.png' height='300' width='200'/>
</body>
</html>";
wv.loadData(str,"text/html","UTF-8");
-
Load webview with BaseURL given code in my answerChirag Ghori– Chirag Ghori2014-01-20 09:36:35 +00:00Commented Jan 20, 2014 at 9:36
Add a comment
|
1 Answer
Try using this code
wv.loadDataWithBaseURL("file:///android_asset/", str, "text/html", "UTF-8",null);
Instead of
wv.loadData(str,"text/html","UTF-8");
2 Comments
steven smith
Six years ago but still works like a charm. Thanks!
vishal_ratna
"file:///android_asset/" never knew this will be required for loading the URL from string