vnshetty
vnshetty

Reputation: 20132

how to get the end of html page in android webview

i'm displaying a web page in android webview. and i want to trigger a message when the user reaches end of page while scrolling. how can i do that? TIA

Upvotes: 0

Views: 1083

Answers (2)

vnshetty
vnshetty

Reputation: 20132

One way is we can write custom MyWebView class that extends WebView and then we can use the function called computeHorizontalScrollRange() orcomputeVirticalScrollRange() to get the scroll range of webview.

Upvotes: 1

Rajath
Rajath

Reputation: 11946

AFAIK, I don't think there is any event that triggers this. But here's one way - you will have to try and see if it works though. Have a ListView with two rows - one having the WebViewClient and another just an ordinary TextView - You could use something like SackOfViewsAdapter for this.

In your adapter's getView(), when the function is called to display the bottom TextView, that's your cue on the user having scrolled down.

Upvotes: 0

Related Questions