(一)
android.view.WindowManager$BadTokenException: Unable to add window — token null is not for an application
如果是这种错误,说明context使用了getApplicationContext(),请换成Activity.this
(二)
BadTokenException: Unable to add window -- token android.os.BinderProxy@XXXXXXXX is not valid; is your activity running?
如果是这种怀疑是使用的context对应的activity在finishing中,当你要显示dialog时
请换一个context或者在create dialog之前判断一下isFinishing()是否为true,是true就不要再显示了