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.