开发者

problem in display image with loadDataWithBaseURL() in Android

In my Application, I display data in webview but it can't display the images in the webview.

I used loadDatawithBaseURL() method.

This is my code..

webview.loadDataWithBaseURL("file:///059600656X/", data, "text/html", "UTF-8", "about:blank");

// here data is a string obje开发者_开发知识库ct which contain html parsing data.

I think it cant find the images in given directory.

Can Anybody help me?


You cannot use simple file:/// URLs with loadDataWithBaseURL(), and "about:blank" probably is not a valid base URL.


To make the loadDataWithBaseURL work you need to make sure of two things:

All image src include "file:///android_asset/imagename"

and the images are in the asset folder!!

So contrary to answer1, it is as simple as that!

Munir Syed


When you use LoadDataWithBaseURL you must specify the image resource as ur baseurl and data must be ur array or image renderer.

example

wv.loadDataWithBaseURL("file:///android_asset/", srray[position], "text/html", "UTF-8", null);

this should help me out

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜