Unable to add window — token android.os.BinderProxy is not valid; is your activity running?

I was seeing this error reported once in a while from some of my apps, and here’s what solved it for me:

if(!((Activity) context).isFinishing())
{
    //show dialog
}

All the other answers out there seem to be doing weird things like iterating through the list of running activities, but this is much simpler and seems to do the trick.

Leave a Comment