1

に問題があり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;
}
4

0 に答える 0