1

Is there anyway to tell if content retreived from a URL into a WebView is full loaded?

EDIT: I am trying to display a indetermined progress widget until the webview is fully loaded?

How would i implement this with WebView.getprogress()?

Ozair Kafray
  • 13,351
  • 8
  • 59
  • 84
coder_For_Life22
  • 26,645
  • 20
  • 86
  • 118
  • Check here http://stackoverflow.com/questions/3149216/how-to-listen-for-a-webview-finishing-loading-a-url-in-android/5172952#5172952 – sealz Aug 03 '11 at 22:03
  • When you mean spinner, do you mean an indeterminate progress widget (the spinning wheel). Or do you literally mean the drop down menu? – Brian Aug 03 '11 at 22:15
  • Sorry for the confusing. I mean indeterminate progress widget. – coder_For_Life22 Aug 03 '11 at 23:20
  • Does this answer your question? [How to listen for a WebView finishing loading a URL?](https://stackoverflow.com/questions/3149216/how-to-listen-for-a-webview-finishing-loading-a-url) – miken32 Oct 16 '22 at 15:35

2 Answers2

3

You can call WebView.getProgress() and see if it's at 100%.

EDIT: Add this to your WebView:

WebView.setWebViewClient(new WebViewClient() {
    public void onPageFinished(WebView view, String url) {
        // do your stuff here
    }
});

As mentioned in this question.

Community
  • 1
  • 1
Brian
  • 7,955
  • 16
  • 66
  • 107
3

For the indeterminate progress spinner, create a ProgressDialog and show it when you start loading the webpage. Then in the onPageFinished() add the ProgressDialog.dismiss() to close it. Refer to this guide to see how to make progress dialogs.

miken32
  • 42,008
  • 16
  • 111
  • 154
Brian
  • 7,955
  • 16
  • 66
  • 107
  • so WebView has a method onPageFinished? or i create the method as you did above? – coder_For_Life22 Aug 04 '11 at 04:15
  • Well you implement the interface WebViewClient by calling `webView.setWebViewClient()` and then replace the dismiss dialog method inside where the `onPageFinished()` method is. Pretty much, copy and paste the code snippet above and replace the variable names of course. Let me know if there are any more questions! – Brian Aug 04 '11 at 04:52
  • Usually on stackoverflow I like an answer so much that I wish I could upvote it twice. Well, this is one of those rare scenarios, where I actually can ;) – Sid Oct 19 '11 at 21:58