3

The documentation for onNewPicture() only says:

Notify the listener that the picture has changed

My question is: When does the picture change?

I noticed that some web pages generate dozens of onNewPicture(), so obviously the "picture" changes many times in the course of rendering the page on a WebView.

What makes a WebView picture change?

I haven't seen any page page that generates less than 2 onNewPicture() calls, so is onNewPicture() guaranteed to be called more than once, for any given HTML page?

Regex Rookie
  • 10,432
  • 15
  • 54
  • 88

1 Answers1

5

PictureListener.onNewPicture() is called whenever the already loaded page finished rendering (or re-rendering in case certain events make the WebKit engine re-calculate page layout). It really depends on the page being loaded:

A simple text-only page will be rendered only once. Other pages (especially Javascript-heavy ones) can be called numerous times after the page finished loading.

Tip by @littleFluffyKitty found in another posting: Many webpages today will cause it to get called fairly often as you move around the page so make sure whatever happens in the onNewPicture() method is quick.

Community
  • 1
  • 1
uTubeFan
  • 6,664
  • 12
  • 41
  • 65