Popupwindow leak window

Source: Internet
Author: User

10:07:51 08-16. 410: ERROR/WindowManager (4236): Activity cn. bookall. android. zbook. reader. docReader has leaked window android. widget. textView @ 485348b0 that was originally added here
10:07:51 08-16. 410: ERROR/WindowManager (4236): android. view. windowLeaked: Activity cn. bookall. android. zbook. reader. docReader has leaked window android. widget. textView @ 485348b0 that was originally added here
08-16 10:07:51. 410: ERROR/WindowManager (4236): at android. view. ViewRoot. <init> (ViewRoot. java: 247)
...

08-16 10:07:51. 410: ERROR/WindowManager (4236): at cn. bookall. android. zbook. reader. DocView. ShowPopWindowCenter (DocView. java: 506)

...

08-16 10:07:51. 600: ERROR/AndroidRuntime (4236): java. lang. IllegalArgumentException: View not attached to window manager


Literally, the Window Leaked is probably a form leak, that is, the memory leak we often call. Why is the form Leaked?

Cause:
We know that every Activity in Android has a WindowManager form manager. Similarly, the dialog box and PopupWindow built on an Activity also have the corresponding WindowManager form manager. Because the Dialog box and popupdomainwn cannot be independent from the Activity, when a Dialog or PopupWindow is being displayed, we finish () the Activity that carries the Dialog (or PopupWindow, the Window
Leaked is abnormal because no one in the WindowManager of this Dialog (or PopupWindow) can attach it, so its form manager has been Leaked.

Solution:
Before closing an Activity, make sure that the attached Dialog or PopupWindow has been closed (dismiss.

@ Override
Public void onPause (){
Super. onPause ();
If (pw! = Null ){
Pw. dismiss ();
}
}

Http://blog.csdn.net/u_xtian/article/details/6123945

Http://www.eoeandroid.com/thread-30137-1-1.html

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.