Android.view.WindowLeaked:Activity Com.xty.activity.ActivityMainPage has leaked window com.android.internal.policy.impl.phonewindow$decorview{41331978 v.e ..... R..... I. 0,0-480,226} that is originally added here
Close dialog (Dialog.dismiss ()) when jumping to another activity via the button on the dialog;
Window leaked probably means that a form leaks, that is, we often say that the memory leaks, why the window experience leaks?
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).
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Android.view.WindowLeaked:Activity com.xty.activity.ActivityMainPage has leaked window com.android.