title: android local webview OnPageFinished firing late
body: <p>I have a webview which loads a local html page and I need to know when it has finished loading so I was using the function onPageFinished() which is fired straight away but for some reason it works fine on websites e.g. google.co.uk.</p>
  
  <pre><code>public class TestwebviewActivity extends Activity {
  /** Called when the activity is first created. */
  WebView webview = null;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
      webview = (WebView) findViewById(R.id.webview);
      Log.d("Webview", "created");
      webview.getSettings().setJavaScriptEnabled(true);
  
      webview.setWebViewClient(new WebViewClient() 
      { 
          public void onPageFinished(WebView view, String url) 
          { 
              Log.d("Webview", "Finished Loading");
  
              Picture picture = view.capturePicture(); 
              Bitmap  b = Bitmap.createBitmap( 300, 300, Bitmap.Config.ARGB_8888); 
              Canvas c = new Canvas( b ); 
              picture.draw( c ); 
              FileOutputStream fos = null; 
              try { 
                  fos = new FileOutputStream( "/sdcard/google_" + System.currentTimeMillis() + ".jpg" ); 
                  if ( fos != null ) 
                  { 
                      b.compress(Bitmap.CompressFormat.JPEG, 90, fos ); 
                      fos.close();
                      Log.d("Webview", "Image Created");
                  } 
              } catch( Exception e ) 
              { 
              //... 
              } 
          } 
      });   
      webview.loadUrl("file:///android_asset/htmlpage.html");
  }
  </code></pre>
  
  <p>}</p>
  
  <p>This has only happened since upgraded to android 3.2 - previously on 2.3</p>
  
  <p>Anyone come across the same issues or any suggestions?</p>
  
  <p>Thanks if anyone can help.</p>