1

I am writing a highbred Android app that uses a lot of webviews. The problem is that the onPageFinished event for a webview is fired when a page is loaded but may not be rendered yet.

I believe there was a onNewPicture but has been removed since version 12.

Has anyone come across the same issue, my spinner basically disappears about 3-4 seconds before the page is actually rendered.

Burf2000
  • 5,001
  • 14
  • 58
  • 117
  • What has your spinner to do with it? Where is that spinner? – greenapps Mar 28 '13 at 13:44
  • Sorry, so as the page loads I display a loading spinner, I then want to hide this once the page has rendered (as opposed to loaded) – Burf2000 Mar 28 '13 at 14:25
  • Are you implying that this happens because pictures have to be loaded yet after onpagefinished? Or is this page doing yet other stuff? – greenapps Mar 28 '13 at 14:55
  • I am not really sure, I assume it javascript libraries loading in to member. We dont have control over the web pages. the page finish loading according to the event about 2-3 seconds later it renders – Burf2000 Mar 28 '13 at 16:31

1 Answers1

0

Rendering of a WebView can take a long time for long documents, and indeed onNewPicture has been deprecated since API 12 (Honeycomb 3.1) and returns a null picture since API level 18 (Jellybean 4.3).

I have tested for API level 17 (JB 4.2), and it still works fine. Probably works fine in API 18 too if you don't need the actual Picture details.

Please this issue on the issue tracker so we can get a non-deprecated replacement.

if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        PictureListener pictureListener = new PictureListener() {
            @Override
            @Deprecated
            public void onNewPicture(WebView view, Picture picture) {
                Log.i(TAG, "Picture changed!");
            }

        };
        webView.setPictureListener(pictureListener);
}
Maarten
  • 6,894
  • 7
  • 55
  • 90
  • I was using this method for a while. Now, I detected that this method called four times and more. – alashow Feb 16 '16 at 23:29