に問題がありAlertDialog
ます。
ユーザーが肯定的なボタンをクリックした場合は戻り、否定的なボタンをクリックした場合は falseAlertDialog
を返したいと思います。true
関数は、ユーザーがボタンをクリックするまでプログラムをブロックする必要があります。
私のコード:
isSuspended = true;
public boolean alertDialog(){
final EditText input = new EditText(context);
new AlertDialog.Builder(context)
.setView(input)
.setPositiveButton("Authenticate", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
if (isValid != 1) {
dialog.cancel();
ShowAlert.showAlertMessage(context, "title",
"Wrong Password!!!");
isSuspended = true;
} else {
dialog.cancel();
ShowAlert.showAlertMessage(context, "title",
"Correct Password!!!");
isSuspended = true;
}
dialog.cancel();
}
})
.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
isSuspended=false;
dialog.cancel();
}
}).show();
return isSuspended;
}