android.view.WindowLeaked: Activity has leaked window com.android.internal.p

android.view.WindowLeaked: Activity  has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{b3e23088 V.E..... R.....ID 0,0-480,243} that was originally added here

这个错误原因是因此一些对话框在activity转向之前,并没有销毁,导致其引用的context为空,因此引发内存泄漏。

在我的代码中原来是:

startActivity(intent);

proDialog.dismiss();

改成了:

proDialog.dismiss();
startActivity(intent);

解决了。

你可能感兴趣的:(android.view.WindowLeaked: Activity has leaked window com.android.internal.p)