我想使用自定义对话框进行 Pin 身份验证。这是我的代码:
public void fetchUI()
{
add=(Button)findViewById(R.id.pinButton);
add.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// TODO Auto-generated method stub
final AlertDialog.Builder alert = new AlertDialog.Builder(MainActivity.this);
final EditText input = new EditText(MainActivity.this);
input.setTransformationMethod(PasswordTransformationMethod.getInstance());
alert.setView(input);
alert.setTitle("Type Your PIN");
alert.setIcon(R.drawable.ic_launcher);
alert.setMessage("Please Type Your PIN below to Authenticate");
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
dialog.cancel();
}
});
alert.show();
}
});
}
现在我想这样做:如果我使用正确的 PIN 单击“确定”,则会出现一个对话框。否则,如果我单击确定,它不会消失。我怎样才能做到这一点?任何帮助将不胜感激。