开发者

WebView throws Receiver not registered: android.widget.ZoomButtonsController

I see this exception sporadically raising up in my application (in the wild). The WebView is used to display a jpg (using the zoom/scroll-capabilities of the Android version/the device instead reinventing the wheel and do all the reflection stuff).

开发者_C百科I have no idea why this exception eventually could come up. Basically I can only think of an Android bug.

What I do (everything in GUI thread):

  • display a thumbnail as preview first
  • set getSettings().setBuiltInZoomControls(false)
  • when the regular picture is loaded, display that one instead
  • set getSettings().setBuiltInZoomControls(true)

Why setting ZoomControls on/off: The thumb should not be zoomable, as the WebView resets this on loadData as soon as the regular picture is available and displayed. Would be some bad user experience.

Example device this is happening: HTC Desire@htc_wwe/htc_bravo/bravo/bravo:2.2/FRF91/226611:user/release-keys

I have exactly the same device/software and it never happend to me...

Any ideas?

Regards, Oliver


I don't like to answer myself, but littleFluffyKitty did not (only in comment).

Solution is in How to safely turn WebView zooming on and off as needed

a) create your own WebView class

public class MyWebView extends WebView {

b) add in it's onDestroy() method:

getSettings().setBuiltInZoomControls(true);

That's it. Thanks to that, no more of those Exceptions show up.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜