EditText inside AlertDialog always null

前端 未结 3 1240
孤城傲影
孤城傲影 2020-12-07 04:07

I\'ve search over the threads but so far I have not found what I\'m looking for. I created a custom Alert Dialog that show up and I can do almost anything with it. It custom

3条回答
  •  攒了一身酷
    2020-12-07 04:40

    The explanation by adamp is great. But that method didn't work for me. The simplest way for me is like this:

    builder.setPositiveButton(R.string.positive, new DialogInterface.OnClickListener() {
                   public void onClick(DialogInterface dialog, int id) {
                       Dialog dialogView = (Dialog) dialog;
                       EditText et;
                       et = (EditText) dialogView.findViewById(R.id.addressinput);
    

    Hope this helps somebody.

提交回复
热议问题