Android WebView, view.capturePicture().getHeight() is 0 -
im 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 called 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, notice later loadurl "http//" works fine dont works on 'file://'. in ???
paste .html file in assets folder of project folder. , create xml file in layout folder fol code: my.xml:
<webview xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/webview" android:layout_width="fill_parent" android:layout_height="fill_parent" />
add fol code in activity
setcontentview(r.layout.my); webview mwebview = null; mwebview = (webview) findviewbyid(r.id.webview); mwebview.getsettings().setjavascriptenabled(true); mwebview.loadurl("file:///android_asset/new.html"); //new.html html file name.
Comments
Post a Comment