Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

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

like image 588
Oliver Avatar asked Feb 05 '11 18:02

Oliver


1 Answers

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.

like image 139
Oliver Avatar answered Nov 09 '22 05:11

Oliver