Skip to content Skip to sidebar Skip to footer

WindowManager: MainActivity Has Leaked Window Com.android.internal.policy.impl.PhoneWindow$DecorView@40731aa0 That Was Original

What does mean this warning? I develop an android application and i see this warning in the logcat. This warning doesn't lead to close the application. Everything runs without any

Solution 1:

The reason for this Exception is, your Activity is being destroyed by calling either finish() in Activity or by some other Exception is thrown in the Activity while your Dialog is showing..

The solution is to call dismiss() on the Dialog you created in view before exiting the Activity, e.g. in onPause(). All windows&dialogs should be closed before leaving an Activity.If you dont dismiss the dialog it will give you that exception..

Like below

@Override
protected void onStop() {
    super.onStop();
    if (dialog!=null) {
        if (dialog.isShowing()) {
            dialog.dismiss();       
        }
    }
}

Post a Comment for "WindowManager: MainActivity Has Leaked Window Com.android.internal.policy.impl.PhoneWindow$DecorView@40731aa0 That Was Original"