This error occasionally occurs when we exit the entire program: Activity has leaked window Com.android.internal.policy.impl.PhoneWindow
The idea is that the form is closed, but dialog is still showing that activity has leaked window (activity infiltration form), which is probably the meaning.
Dialog dismiss () should be dropped before activity finish ().
My approach is to rewrite the OnDestroy () method of this activity, in which dialog is cleared:
/*** This method must be rewritten in order to refuse to exit the activity when the error dialog not dismiss*/@Overrideprotected voidOnDestroy () {//TODO auto-generated Method Stub Try{Mydialog.dismiss (); }Catch(Exception e) {System.out.println ("Mydialog canceled, failed!" "); //Todo:handle Exception } Super. OnDestroy (); }
Android learns--activity Close and Dialog.dismiss conflict resolution (Activity has leaked window Com.android.internal.policy.impl.PhoneWindow )