Images in Android assets subfolder do not display in WebView -
i've seen lot of similar questions here, none of them seem problem.
i'm loading local html file subfolder of assets folder webview. file located in assets/myfolder/myfolder2/test.html.
also in assets/myfolder/myfolder2/ have image.jpg. full path: assets/myfolder/myfolder2/image.jpg
i loading html so:
// html contains string content of test.html file webview.loaddatawithbaseurl("file:///android_asset/myfolder/myfolder2/", html, "text/html", "utf-8", "about:blank");
in html string, have following tag:
<img src="image.jpg" />
the image not displayed. i've tried spelling out full file:/// url image well, no luck. if change link image somewhere out on web, works fine. why can't find local image?
to load html asset folder should use webview.loadurl()
.
i have created 2 subfolders inside assets folder named "folder1" , "folder2".
have put image in
folder2
.have put html file image tag
"<img src="ic_launcher.png">"
and @ last used webview.loadurl("file:///android_asset/folder1/folder2/test.html");
i can see image loaded in webview.
Comments
Post a Comment