Android. view. WindowLeaked solution: androidwindowleaked
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 exception will be thrown, 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.
For example:
@ Override protected void onDestroy () {super. onDestroy (); if (mDialog! = Null) {mDialog. dismiss ();}}