Issue
In earlier releases of Android, an app could obtain a Picture of a web page by setting a WebView.PictureListener and then waiting for onNewPicture to be called to provide the Picture. This had issues, as onNewPicture was called many times, but at least the app got its Picture.
This has gone away in a recent version of Android (it is not working for me in 4.3, onNewPicture just gives me null for the Picture).
The app needs to (a) call loadUrl or loadData (b) wait until the page has been received and rendered and then (c) capture the image of the page.
Does anyone know how to get a Picture of a web page after it has been loaded and rendered (in a recent release of Android)?
(I should add: I know how to create the WebView and load the URL or HTML; it is just getting the Picture that I need).
Solution
According to the docs for capturePicture()
you need to call webview.onDraw
and pass in a Bitmap
-backed Canvas
.
Answered By - marcin.kosiba
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.