Solutions for android.view.WindowLeaked

Source: Internet
Author: User


Android.view.WindowLeaked generally occur in the activity of the dialog display.

When the android dialog is created, it passes a parameter this, that is, the current Activity,dialog must be released before the activity is destroyed, otherwise it will be reported windowleaked error.

The reasons for this analysis are:

Dialog is created based on activity: New ProgressDialog (this), and this is activity. Activtity first finish, that dialog will not have dependency, so will be reported android.view.WindowLeaked.

Every activity in Android has a WindowManager form manager, as well as a dialog box built on top of an activity, and Popupwindow has a corresponding WindowManager form manager. Because dialogs and Popupwindown cannot be separated from activity, we go to finish () to carry the dialog (or Popupwindow) when a dialog or a Popupwindow is being displayed. Activity, it will throw window leaked exception, because this dialog (or Popupwindow) WindowManager No one can be attached, so its form manager has been leaked.

So get the dialog out of the dismiss before finish.

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.