Just had this same issue. Its because of the onClick handler:
public void onClick (DialogInterface dialog, int which) {
super.onClick();
selectedValue = Integer.parseInt(intEdit.getText().toString());
}
Remove it, and you won't have the issue. If you need to know the button pressed, then just check the button type in that event handler block. For example
@Override
public void onClick(DialogInterface dialog, int which) {
buttonPress = which;
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (buttonPress == DialogInterface.BUTTON_NEGATIVE) {
String computerName = _etComputerName.getText().toString();
SharedPreferences computers = _context.getSharedPreferences(
"COMPUTERS", 0);
SharedPreferences.Editor editor = computers.edit();
editor.remove(computerName);
editor.commit();
this.callChangeListener(-1);
}
}