Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does onNewPicture() get called?

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?

like image 658
Regex Rookie Avatar asked Apr 21 '26 17:04

Regex Rookie


1 Answers

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.

like image 79
uTubeFan Avatar answered Apr 24 '26 06:04

uTubeFan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!