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,142
  • 8
  • 54
  • 80
coder_For_Life22
  • 25,901
  • 20
  • 83
  • 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

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,777
  • 15
  • 64
  • 104
3

Stackoverflow is having some problems allowing me to edit my question and this is kind of an extension to the second part of your question so don't flag or down vote this for having two answers.

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.

Brian
  • 7,777
  • 15
  • 64
  • 104
  • 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