//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(); }