// 对话框
AlertDialog.Builder builder = new Builder(MainActivity.this);
builder.setMessage("是否确认删除!")
.setPositiveButton("确认",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
dialog.dismiss();
Toast.makeText(MainActivity.this,
"删除成功", 0).show();
}
})
.setNegativeButton("取消删除",
new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog,
int which) {
// TODO Auto-generated method stub
dialog.cancel();
Toast.makeText(MainActivity.this, "取消成功",
0).show();
}
}).create().show();