Android WebView, view.capturePicture().getHeight() is 0 -
i'm working on android 4.0. have webview want capture screen. override webviewclient onpagefinished folow:
@override public void onpagefinished(webview view, string url) { picture picture = view.capturepicture(); toast.maketext(finplan.this, "picture height "+picture.getheight()+ " url "+url, toast.length_long).show(); in procedure call loadurl():
mywebview.loadurl("http://www.google.com"); // 1 works fine , picture.getheight() > 0 mywebview.loadurl("file:///android_asset/test.html"); // 1 works, picture.getheight() retrieved in onpagefinished 0 test.html simple html file, noticed later loadurl() http// works fine doesn't works on file://. in ???
try way
webview.setwebviewclient(new webviewclient() { @override public void onpagefinished(webview view, string url) { picture picture = view.capturepicture(); } }); webview.setpicturelistener(new picturelistener() { public void onnewpicture(webview view, picture picture) { if (picture != null) { toast.maketext(mainactivity.this, "picture height " + picture.getheight(), toast.length_long).show(); } } });
Comments
Post a Comment