Android Form Leak issue

Source: Internet
Author: User

Recently encountered such a problem:

E/windowmanager (30314): android.view.WindowLeaked:Activity com.xxxxxx.www.activity.XXXActivity has leaked window Com.android.internal.policy.impl.phonewindow$decorview{52b0f3ac v.e ..... R...... D 0,0-120,95} That is originally added here;


This is a form leaking exception, the general solution is to make the form (dialog or Popupwindow) dismiss () before Activity.finish (), the idea is correct, but not very comprehensive, Sometimes it will be found that even if your code inside the form is closed, the problem will still appear, today on the stack overflow found a more comprehensive answer here to share the first link to everyone http://stackoverflow.com/questions/ 2850573/activity-has-leaked-window-that-was-originally-added


Here are 3 answers for each of the three cases, the first one as above, the form closed after activity closed, the second case is actually the same as the first reason, but the reason why the activity is closed is not that we actively closed activity, Instead of catching the exception that caused the activity to close prematurely, and then when we go to invoke the form to show the occurrence of this exception, so the real need to solve is more than this form leak exception of the earlier exception (PS: This time I was down here, completely did not notice the error log of the earlier printing ... --! The third situation I haven't met has not been told.



This article only records the development of the experience spent more time is not easy to find the problem. Mark



Android Form Leak issue

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.