0

我创建了一个 AlertDialog.Builder 并为其设置了 setItem,我想将一个 AlertDialog.Builder 添加到 onClick() 方法中:

AlertDialog.Builder dialog_tk = new AlertDialog.Builder(v.getContext());
            dialog_tk.setTitle("Thống kê tổng số sinh viên")
            .setItems(dssinhvien, new DialogInterface.OnClickListener() {

                        @Override
                        public void onClick(DialogInterface arg0, int arg1) {
                            // TODO Auto-generated method stub
                            //Toast.makeText(getBaseContext(), dssinhvien[arg1], Toast.LENGTH_SHORT).show();
                            AlertDialog.Builder infomation = new AlertDialog.Builder(getApplicationContext());
                            infomation.setTitle("Thông tin sinh viên "+dssinhvien[arg1])
                            .setMessage(danhsach.getinfo(dssinhvien[arg1]));
                            infomation.create().show();
                        }
                    });
            dialog_tk.create().show();

有人帮我回答“当我在 AlertDialog 上选择一个项目时,我可以在一个 AlertDialog.Builder 中创建一个 AlertDialog.Builder 吗?” 我对第二个 AlertDialog.Builder 有疑问:

AlertDialog.Builder infomation = new AlertDialog.Builder(getApplicationContext());

谢谢!

4

0 回答 0