今天在写AlertDialog的时候一直各种报错,记录一下几个错误原因:
1、导入包import android.app.AlertDialog,不知道为什么eclipse不能自动导入也没有导入选项;
2、new AlertDialog.Builder(MainActivity.this)
.setTitle(item)
.setMessage("确定删除吗?")
.setPositiveButton("是", null)
.setNegativeButton("否", null)
.show();
这句话new AlertDialog.Builder(MainActivity.this) 写错this、null、或者self都不行。
AlertDialog
推荐阅读更多精彩内容
- 转自:http://android.blog.51cto.com/268543/333769/ 本文是对网上的文章...
- Andorid中经常使用到格式对话框。如下: 1.确定对话框: 实现代码: new AlertDialog.Bui...