自定义对话框 提示:Unable to add window token null is not for an application
生活随笔
收集整理的這篇文章主要介紹了
自定义对话框 提示:Unable to add window token null is not for an application
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
這是因為在new Dialog(context);的時候傳入的context是通過getApplicationContext()獲得的,這樣就會報錯。
把context的獲得方式改為MainActivity.this就好了。
轉(zhuǎn)載于:https://www.cnblogs.com/qlong8807/p/5167560.html
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎勵來咯,堅持創(chuàng)作打卡瓜分現(xiàn)金大獎總結(jié)
以上是生活随笔為你收集整理的自定义对话框 提示:Unable to add window token null is not for an application的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 考托福
- 下一篇: Python 拷贝对象(深拷贝deepc