I want to use a custom dialog box for Pin Authentication. Here is my code:
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();
}
});
}
Now I want to do this: if I click on OK with the correct PIN, then a dialog box disappears. Otherwise, if I click on OK, it won't disappear. How can I achieve this? Any help will be appreciated.