Android Question WebViewExtras: pageDown-Methode

Andie

Member
Licensed User
Longtime User
Hi, with the help of the WebViewExtras library one is able to scroll down a website, which is displayed in a WebView: (WebViewExtras1 and WebView1 are instances of WebViewExtras und WebView respectively)
B4X:
WebViewExtras1.pageDown(WebView1, true)
This works fine, assuming that the LoadUrl()-method was applied on the WebView. But one can also apply the LoadHtml()-method. For example:
B4X:
WebView1.LoadHtml("<html><body>text ... and much, much more ... text</body></html>")
But using the pageDown()-method then, doesn't show any effect. Has anyone an explanation for it? May be some tag is missing in the html-Text?
 

eurojam

Well-Known Member
Licensed User
Longtime User
I guess, that webview1.loadHtml is an asynchronous task and pageDown will be executed before the page finished loading. one solution is may be to run the pagedown delayed. But I haven't tried this...
 
Upvote 0

Andie

Member
Licensed User
Longtime User
You are absolutely right and I took care of it by using:
B4X:
WebView1_PageFinished (Url As String)
WebViewExtras1.pageDown(WebView1, true)
End Sub
However, as you see, I left the argument of this PageFinished-event i. e. (Url as String) unchanged, because I don't know what argument I could use instead.
 
Upvote 0

Andie

Member
Licensed User
Longtime User
If think there's no need to work with a delay, because the PageFinished-event works perfectly.
I'm still wondering why in the case of:
B4X:
WebView1.LoadUrl("https://www.b4x.com")
the pageDown-method works fine, while in the case of:
B4X:
WebView1.LoadUrl("file://" & File.DirInternal & "/test.htm")
it does not.
 
Last edited:
Upvote 0
Top