我在android中创建了一个自定义对话框。我尝试使用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();
}