Many of us have come across the dreaded
E/WindowManager﹕ android.view.WindowLeaked
This can happen for several reasons as is mentioned here and in many other SO questions.
I have tried making sure my dialogs are in a "good place" before showing them, often wrapping them around certain conditions like:
if (!isFinishing() && !isDestroyed()) {
mDialog.show();
}
I'm curious if anyone knows of a "perfect environment" for which an AlertDialog is guaranteed to always display without error. From personal experience, even with the above conditions, the WindowLeaked error still always comes up.