May i know how to avoid AlertDialog
to close even when i click the OK.
The reason for this is to make a simple error handling when there is a wrong input.
------------------------
Input password
------------------------
Password:______________
_______________________
| OK | | Cancel|
I want this dialog to remain when there is wrong input. so that the user can input again.
My code:
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setTitle("Insert Passcode");
final EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_TEXT_VARIATION_PASSWORD);
builder.setView(input);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
m_Text = input.getText().toString() ;
if (m_Text.equals(String.valueOf(passcode_value))){
btnAutoLogin.performClick();
}
else
{
xxxxxxxxxxxxxxx
}
}
});
builder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.cancel();
}
});
builder.show();