现在的位置: 首页 > 综合 > 正文

关于android创建对话框报错The method setPositiveButton(int, DialogInterface.OnClickListener) in the type Alert

2018年04月07日 ⁄ 综合 ⁄ 共 390字 ⁄ 字号 评论关闭

The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder is not applicable for the arguments (String, new   View.OnClickListener(){})

Here is your solution, you did a silly mistake there buddy.

It should not be

.setNegativeButton("Don't Remind", new OnClickListener() 

It should be

.setNegativeButton("Don't Remind", new DialogInterface.OnClickListener()
只要这样写,就不报错了!本人水平有限,也不知道什么原因,希望对你能有帮助!

抱歉!评论已关闭.