开发者

problem in display image with loadDataWithBaseURL() in Android

开发者 https://www.devze.com 2022-12-27 08:50 出处:网络
In my Application, I display data in webview but it can\'t display the images in the webview. I used loadDatawithBaseURL() method.

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

精彩评论

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