I\'m doing some background work and showing a DialogFragment while I do that. Once my work is done and the relevant callback is invoked, I dismiss the dialog. When I do, I get a
Checking if it's Visible before dimissing could avoid this null pointer exception
if (mDialog != null && mDialog.isVisible) { mDialog.dismiss(); mDialog = null; }