0
다음 코드에서 AlertDialog
상자를 닫으려고했지만 아무 소용이 없었습니다. 그러나 compareKeys()
함수를 제거하면 해제됩니다. 그렇다면 compareKeys()
함수를 호출 한 후이를 닫을 수 있습니까?Android에서 AlertDialog.Builder 닫기
public void promptAdministratorPassword() {
AlertDialog.Builder alert = new AlertDialog.Builder(this);
alert.setTitle("Alert!");
alert.setMessage("Please enter your password: ");
// Set an EditText view to get user input
final EditText input = new EditText(this);
alert.setView(input);
alert.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
password = input.getText().toString();
if (password.equals("password")) {
try {
compareKeys();
} catch (IOException | NoSuchAlgorithmException | InvalidKeySpecException e) {
e.printStackTrace();
}
}
dialog.dismiss();
}
});
alert.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
// Canceled.
}
});
alert.show();
}
감사합니다. 정말로 감사드립니다. – hahas92
암호 해독 버튼이 암호와 일치하지 않으면 작동합니다. 암호가 일치하면 해지 할 수 있습니까? 지금은 잘못된 암호를 입력하면 해제됩니다. 하지만 올바른 암호를 입력하면 해산되지 않습니다. – hahas92