我創建了一個警報對話框構建器,其中顯示對話框中的表單我的正面按鈕名稱提交我希望按鈕被禁用,除非表單中的所有字段都已填充.Below是我的代碼可以幫助我們解決這個問題。 感謝禁用警報對話框構建器中的正向按鈕
alertDialogBuilder.setPositiveButton("SAVE", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
nameInput1 = data_txt1.getText().toString();
nameInput2 = data_txt2.getText().toString();
nameInput3 = data_txt3.getText().toString();
nameInput4 = data_txt4.getText().toString();
nameInput5 = data_txt5.getText().toString();
nameInput6 = auto_txt1.getText().toString();
nameInput7 = auto_txt2.getText().toString();
nameInput8 = auto_txt3.getText().toString();
nameInput9 = auto_txt4.getText().toString();
nameInput10 = auto_txt5.getText().toString();
nameInput11 = auto_txt6.getText().toString();
nameInput12 = auto_txt7.getText().toString();
nameInput13 = auto_txt8.getText().toString();
nameInput14 = auto_txt9.getText().toString();
nameInput15 = data_txt6.getText().toString();
nameInput16 = data_txt7.getText().toString();
Call<Void> completeQuestionnaireCall = spreadsheetWebService.completeQuestionnaire(nameInput1, nameInput2, nameInput3, nameInput4, nameInput5, nameInput6, nameInput7, nameInput8, nameInput9, nameInput10, nameInput11, nameInput12, nameInput13, nameInput14, nameInput15, nameInput16);
completeQuestionnaireCall.enqueue(callCallback);
dialog.dismiss();
}
}
});
alertDialogBuilder.setNegativeButton("Cancel", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int id) {
dialog.cancel();
}
});
alertDialogBuilder.show();
}