title: How to determine when Android WebView is completely done loading?
body: <p>I want to know how to determine when a WebView is <strong><em>completely</em></strong> done loading.</p>
  
  <p>Let me define <strong><em>completely</em></strong>.</p>
  
  <ul>
  <li>All redirects have happened</li>
  <li>The page is visibly displayed, nothing has yet to load</li>
  </ul>
  
  <p>Bad answers to this question:</p>
  
  <p><code>WebViewClient.onPageFinished()</code> - this fires multiple times if there are redirects loading a page. It also fires before the page is displayed.</p>
  
  <p><code>PictureListener.onNewPicture()</code> - this fires every time the screen changes and AFAICT each redirect. How would I know which firing is the final one?</p>
  
  <p><code>WebChromeClient.onProgressChanged()</code> - same problem as onPageFinished. (Added after David suggested this solution below)</p>
  
  <p><code>Thread.sleep(5000)</code> - should be obvious, why this isn't acceptable.</p>
  
  <p>Of course, a clever combination of the above that works would be perfect.</p>
  
  <p>Why do I want to know this you ask?
  Because I want to inject some javascript <strong><em>one time</em></strong> once the webview is <strong><em>completely</em></strong> done loading.</p>