Android troubleshooting: has leaked window com. Android. Internal. Policy. impl. phonewindow $ that was originally added

Source: Internet
Author: User

Exception scenarios:

It is often necessary to process time-consuming work in applications, such as reading large files and accessing network resources. To avoidProgramPoor user experience caused by false positives. Generally, we can use the thread + handler or Android-providedAsynctask to solve this problem, and usually uses ssdialog and other prompt controls to inform the user of the current program progress. The exceptions described in the title often appear in such scenarios, and often conceal the real culprit of exceptions.

 

Cause:

In the exception description, it means that a phonewindow cannot be destroyed in time due to window handle leakage. This tends to mislead us and focus too much on finding the so-called memory leakage. In fact, there is a serious exception caused by improper operations in some of our non-main threads, which forces the current activity to be closed. While disabling, dismiss cannot be called in time to cancelProgressdialog and so on, the system throws an error in the title, and masks the exception information that actually causes this error.

 

One solution:

This solution does not actually solve the problem, but can reveal the exception information that actually leads to errors to a certain extent. That is, override the ondestroy method of the activity and call dismiss in the method to cancelProgressdialog and so on.

Related Article

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.