弹出类提示框传入参数问题

来源:互联网 发布:mac上怎么解压缩 编辑:程序博客网 时间:2024/05/16 23:02

做项目的时候 出现android.view.WindowManager $ BadTokenException异常,找错误原因,看到这么一段话:

You need to use your Activty as the Context for the Dialog not the Application.Android is looking for a view to display the Dialog in and the Application does not have one but yourActivity will.The Application is an object which ties your app together and has a Context as it knows about which locale you're running in and so on, but it relies on Activities to display things to the user. 哦,原来这种弹出类的控件传入参数的时候不能传入context值,必须传入activity.this类型的值,将传入的值改为activity.this,搞定!

0 0