首页 > 代码库 > 弹出一个对话框并且对是和否绑定事件

弹出一个对话框并且对是和否绑定事件

 
//String  是用来显示提示内容protected void dialog(String result) {        AlertDialog.Builder builder = new Builder(MainActivity.this);        builder.setMessage(result);        builder.setTitle("提示");        builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {            @Override            public void onClick(DialogInterface dialog,int which) {                passwordTextId.setText("");            }        });        builder.setNegativeButton("退出", new DialogInterface.OnClickListener() {            @Override            public void onClick(DialogInterface dialog,int which) {                dialog.dismiss();                MainActivity.this.finish();            }        });                builder.create().show();            }