Although it is a small problem, but also troubled me for a period of time, now write down, to do a memo for themselves, also can give other people a reference.
Android.view.WindowLeaked literally, window leaked is probably said that a form leak, that is, we often say that the memory leak, why the window experience leaks it?
Cause:
We know that every activity in Android has a WindowManager form manager, and similarly, a dialog box built on top of an activity, Popupwindow also 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.
Workaround:
Before closing (finish) an activity, make sure that the dialog or popupwindow attached to it is closed (dismiss).
Solutions for android.view.WindowLeaked anomalies