I created a webview wv_img and loadurl to fill the conentent with some tables, and images.
Then do wv_img.CaptureBitmap to a bitmap. But this randomly failed.
I suspected the wv_img.loadurl is slow then tried to wait until it is finished. But the event triggered far before it finish loading, i.e. immediate said "load url ok".
How could I wait for the page finish loading?
Then do wv_img.CaptureBitmap to a bitmap. But this randomly failed.
B4X:
Dim lbmp As Bitmap, lbok As Boolean
lbok = False
Dim cnt As Int
For cnt = 0 To 50
If lbok = False Then
lbok = True
wv_img.Invalidate
Try
lbmp = wv_img.CaptureBitmap
Catch
lbok = False
Log("capturebitmap failed")
End Try
End If
Next
I suspected the wv_img.loadurl is slow then tried to wait until it is finished. But the event triggered far before it finish loading, i.e. immediate said "load url ok".
B4X:
Private wv_img As WebView
wv_img.LoadUrl(....)
Wait For wv_img_PageFinished (url As String)
Log("wv_img load url ok")
How could I wait for the page finish loading?