The method setButton(int, CharSequence, Message) in the type AlertDialog is not applicable for the a
用dialog做弹出框的时候,报错,如下图
感觉很奇怪,报的错误,我写在标题了,,解决方法,在OnClickListener前添加DialogInterface
例如取消,, alert.setButton(DialogInterface.BUTTON_NEGATIVE, "取消",new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,int which) {
finish();
}
});
为什么这么改,
实际上就是一个错误,AlertDialog.setButton()里,第三个参数是一个OnClickListener,这个监听器类是DialogInterface里的,看异常说明,你那导入的类应该是View类里的OnClickListener。所以会出现类型异常。
这是我百度的,别人的回答。
The method setButton(int, CharSequence, Message) in the type AlertDialog is not applicable for the a相关推荐
- The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i
The method setPositiveButton(int, DialogInterface.OnClickListener) in the type AlertDialog.Builder i ...
- The method setClass(Context, Class?) in the type Intent is not applicable for the arguments (GameV
在当前短信内容的activity中写 Bundle bun = new Bundle(); bun.putString("message", ...
- The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory的解决方法...
最近又开始看jsp,那时候用的tomcat还是5的版本,我现在自己下的用的是tomcat6,在运行随书光盘的例子的时候,报了这样的错误: type Exception report message d ...
- Mapper method 'dao.xxx' has an unsupported return type
前后端分离,前端上传数据,后台一直报这个Mapper method 'dao.xxx' has an unsupported return type错误,后来才发现是不需要返回值结果的,把返回值类型改 ...
- cannot use message (variable of type protoreflect.ProtoMessage) as type protoiface.MessageV1 in argu
错误: cannot use message (variable of type protoreflect.ProtoMessage) as type protoiface.MessageV1 in ...
- Method cannot be marked @objc because the type of the parameter 1 cannot be represented in Objective
错误:Method cannot be marked @objc because the type of the parameter 1 cannot be represented in Object ...
- The method setOnClickListener(View.OnClickListener) in the type View is not applicable
开始学习 android 了,学习的是高明鑫老师的android视频教程(android视频教学). 学到第八讲时, 在写动态设置时报错: The method setOnClickListener( ...
- Type safety: The method add(Object) belongs to the raw type List. References to generic type List<E>
1 java 报错如下 Type safety: The method add(Object) belongs to the raw type List. References to generic ...
- Android NDK 【错误】The method loadLibrary(String) is undefined for the type Settings.Syste
[错误]The method loadLibrary(String) is undefined for the type Settings.System [解决方法] 不要加入包import andr ...
最新文章
- C语言基础_函数指针
- 从功能测试到性能测试的转型之路
- 一次性动态绑定多个droplistdown
- 这些道理不懂,你注定就是穷打工的命!(转载)
- 中石油训练赛 - Spiral Matrix(找规律)
- java生成16位随机数_java中如何产生一个16位数字组成的随机字符串?谢谢各位了...
- php中修改元素值为5,php怎么改变元素数组的值
- 首次超过苹果!华为高端智能手机Q1国内市场出货量占48%
- vb取消文本框的粘贴功能
- L1-048 矩阵A乘以B-PAT团体程序设计天梯赛GPLT
- 虚拟化—用新的视角看IT
- 论.NET反射、委托与模式关系 zt- -
- Chrome免安装版制作
- python绘制3d点云_python – 来自点云的3D凸包
- 相片打印机原理_手机照片打印机的原理是什么 便携式照片打印机到底好不好...
- 小说阅读 (支持txt文本文件浏览)
- [附源码]java毕业设计网上宠物商店
- bootstrap 表格表头固定
- 基于Aforge的物体运动识别-入门篇
- reason:The server time zone value '???ú±ê×??±??' is unrecognized or represents more than one time zo