Solutions for Android. View. windowleaked exceptions

Source: Internet
Author: User

Although it is a small problem, it has also plagued me for a while. Now, let's write down and give myself a memo. You can also give others a reference.

 

Android. View. windowleaked literally understands that window leaked is probably a form leaked, that is, we often say Memory leakage. 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. BecauseThe dialog box and popupdomainwn cannot be independent from the activity.So when a dialog or popupwindow is displayed, we finish () the activity that carries the dialog (or popupwindow), and the window leaked exception will be thrown, becauseNo one can attach the windowmanager of this dialog (or popupwindow )., So its form manager has been leaked.

Solution:
Before closing an activity, make sure that the attached dialog or popupwindow has been closed (dismiss.

 

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.