Activity has leaked window that was originally added

You’re trying to show a Dialog after you’ve exited an Activity.

[EDIT]

This question is one of the top search on google for android developer,
therefore Adding few important points from comments, which might be more helpful for future investigator without going in depth of comment conversation.

Answer 1 :

You’re trying to show a Dialog after you’ve exited an Activity.

Answer 2

This error can be a little misleading in some circumstances (although
the answer is still completely accurate) – i.e. in my case an
unhandled Exception was thrown in an AsyncTask, which caused the
Activity to shutdown, then an open progressdialog caused this
Exception.. so the ‘real’ exception was a little earlier in the log

Answer 3

Call dismiss() on the Dialog instance you created before exiting your
Activity, e.g. in onPause() or onDestroy()

Leave a Comment