上次看了一个关于android中对话框的使用,其中对带确定和取消的对话框讲的并不详细,自己补全了一下,当确定和取消按钮中有事件时的情况,没事件时用null就行了
new AlertDialog.Builder(this).setTitle("标题").setMessage("提示的信息")
.setPositiveButton("确定", new DialogInterface.OnClickListener() {public void onClick(DialogInterface dialog, int which){
dialog.dismiss();
// SysPassDao pass = new SysPassDao(MainActivity.this);这里是自己写的方法,其他的是都需要的
// pass.roleAll();
MainActivity.this.finish();
}
})
.setNegativeButton("取消", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
}
}).show();
博主上次看了Android中对话框的使用,发现带确定和取消的对话框讲解不详细,于是自行补全了确定和取消按钮有事件时的情况,无事件时用null即可,并给出了相关代码示例。

1961

被折叠的 条评论
为什么被折叠?



