This may also occur when you call dismiss() before you have called show() like Sogger said.
After Dialog object is constructed but before dialog is not showed, if (mDialog != null) can be passed and NullPointerException will occur.
When you check if mDialog is null or not,
if (mDialog != null) {
mDialog.dismiss();
mDialog = null;
}
Add more conditions like below,
if ((mDialog != null) && mDialog.isAdded() && mDialog.isResumed()) {
mDialog.dismiss();
mDialog = null;
}
I think that mDialog.isAdded() condition might be enough...
.
stackoverflow.comm
No comments:
Post a Comment