开发者

When does onNewPicture() get called?

开发者 https://www.devze.com 2023-02-21 18:20 出处:网络
The documentation for onNewPicture() only says: Notify the listener that the picture h开发者_JS百科as changed

The documentation for onNewPicture() only says:

Notify the listener that the picture h开发者_JS百科as 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消