我已經在android.i中創建了一個自定義對話框,試圖用dismiss()來解除它,但是我的對話框仍然沒有被解僱,下面的代碼可以幫助我。如何關閉自定義對話框
void unsubPhoneNumberDialogBox(final ArrayList<String> unsubcribeList)
{
AlertDialog.Builder builder;
LayoutInflater inflater = (LayoutInflater) this.getSystemService(LAYOUT_INFLATER_SERVICE);
View layout = inflater.inflate(R.layout.customalert,null);
builder = new AlertDialog.Builder(SMSServiceListActivity.this);
builder.setView(layout);
alertDialog = builder.create();
input = (EditText)layout.findViewById(R.id.txtPhoneNo);
btnVerify = (Button)layout.findViewById(R.id.btnSendSMS);
btnVerify.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(input.getWindowToken(), 0);
alertDialog.dismiss();
}
});
alertDialog.show();
}
是對clickHandler被稱爲? – 2013-03-13 12:02:05
您的'alertDialog'定義在哪裏?你可以做'builder.create()'&'builder.dismiss()'&'builder.show()'?還是我誤會了? – TronicZomB 2013-03-13 12:07:14
@ Ahmed:是它被稱爲 – user578386 2013-03-13 12:14:38