What is this error, and why does it happen?
05-17 18:24:57.069: ERROR/WindowManager(18850): Activity com.mypkg.myP has leaked window com.android.internal.pol
The answers to this question were all correct, but a little confusing for me to actually understand why. After playing around for around 2 hours the reason to this error (in my case) hit me:
You already know, from reading other answers, that the has X has leaked window DecorView@d9e6131[]
error means a dialog was open when your app closed. But why?
It could be, that your app crashed for some other reason while your dialog was open
This lead to your app closing because of some bug in your code, which lead to the dialog remaining open at the same time as your app closed due to the other error.
So, look through your logical. Solve the first error, and then the second error will solve itself
One error causes another, which causes another, like DOMINOS!