lixplor / android-Q-A

🐞 android related questions and answers
0 stars 0 forks source link

Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46029dd0 #47

Closed lixplor closed 7 years ago

lixplor commented 7 years ago

Activity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@46029dd0

lixplor commented 7 years ago

原因: 在activity销毁时dialog仍然显示 解决: 在activity的onDestroy()中加入以下代码

@Override
public void onDestroy() {
    super.onDestroy();
    if (dialog != null) {
        dialog.dismiss();
        dialog = null;
    }
}