How to use zoom to crash webview in Android 3. x

Source: Internet
Author: User

09-29 21:44:08. 557: Error/activitythread (31036): Activity XXX has leaked intentreceiver
Android. widget. zoombuttonscontroller $1 @ 419abcf0 that was originally registered here. Are you missing a call to unregisterreceiver ()?
09-29 21:44:08. 557: Error/activitythread (31036): Android. App. intentreceiverleaked: XXX has leaked intentreceiver
Android. widget. zoombuttonscontroller $1 @ 419abcf0 that was originally registered here. Are you missing a call to unregisterreceiver ()?
09-29 21:44:08. 917: Error/androidruntime (31036): Java. Lang. illegalargumentexception: runner Er not registered:
Android. widget. zoombuttonscontroller $1 @ 419abcf0
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. App. loadedapk. forgetreceiverdispatcher
(Fig. Java: 650)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. App. contextimpl. unregisterreceiver
(Contextimpl. Java: 1091)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. content. contextwrapper. unregisterreceiver
(Contextwrapper. Java: 354)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. widget. zoombuttonscontroller. setvisible
(Zoombuttonscontroller. Java: 405)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. widget. zoombuttonscontroller $2. handlemessage
(Zoombuttonscontroller. Java: 179)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. OS. handler. dispatchmessage (handler. Java: 99)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. OS. Looper. Loop (Looper. Java: 152)
09-29 21:44:08. 917: Error/androidruntime (31036): at Android. App. activitythread. Main (activitythread. Java: 4559)
09-29 21:44:08. 917: Error/androidruntime (31036): At java. Lang. Reflect. method. invokenative (native method)
09-29 21:44:08. 917: Error/androidruntime (31036): At java. Lang. Reflect. method. Invoke (method. Java: 491)
09-29 21:44:08. 917: Error/androidruntime (31036): At com. Android. Internal. OS. zygoteinit $ methodandargscaller. Run
(Maid. Java: 841)
09-29 21:44:08. 917: Error/androidruntime (31036): At com. Android. Internal. OS. zygoteinit. Main (zygoteinit. Java: 599)
09-29 21:44:08. 917: Error/androidruntime (31036): At Dalvik. system. nativestart. Main (native method)

Webview contains a zoombuttonscontroller. When web. getsettings (). setbuiltinzoomcontrols (true) is enabled, the scaling control icon appears once you touch the screen. This icon will automatically disappear in a few seconds, but on the 3.x system, if the icon exits the current activity before it disappears automatically, the above exceptions will be reported.
Based on the exception information, refer to the webview source code to know that zoombuttonscontroller has a register and unregister process. However, we cannot control these two processes. webview has APIs for display control, but we cannot access them. We can only access these items related to the control of zoombuttonscontroller:
Void setbuiltinzoomcontrols (Boolean enabled)
Void setdefaultzoom (websettings. zoomdensity zoom)
Void setdisplayzoomcontrols (Boolean enabled)
Void setsupportzoom (Boolean Support)
It does not work if you try it again.
Finally, let's look at the ultimate resolution solution.
Add the following sentence to ondestroy of the activity: Web. setvisibility (view. Gone); Set webview to gone.

In addition, this problem does not exist on 2.x.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.