Android Question Webview CaptureBitmap not working with api 21+


Well-Known Member
Licensed User
An App of mine used the webview.CaptureBitmap method successful the last few years.
It worked as expected even with contents longer than the webviews height.

After changing the Manifest from "20" to
the resulting Bitmap now has only the top visible part of the webview.

According to this and this the result of capturebitmap is different now due to performance reasons.

Is there something I can do to get the full webview content as a bitmap even with targetSdkVersion=21 and up?



Well-Known Member
Licensed User
Call this sub from Activity_Create (before you load the layout):
Sub EnableSlowWebViewDocumentDraw
   Dim p As Phone
   If p.SdkVersion >= 21 Then
     Dim jo As JavaObject
     jo.InitializeStatic("android.webkit.WebView").RunMethod("enableSlowWholeDocumentDraw", Null)
   End If
End Sub

Thank you Erel!
It worked.
Upvote 0