安卓开发之如何解决AlertDialog.Builder没有dismiss()方法

  final AlertDialog.Builder customizeDialog =
                new AlertDialog.Builder(MainActivity.this);
        customizeDialog.create();
        final View dialogView = LayoutInflater.from(MainActivity.this)
                .inflate(R.layout.dialog_customize,null);
        ListView listView=dialogView.findViewById(R.id.groups_listview);
        ArrayAdapter adapter = new ArrayAdapter(
                this,
                android.R.layout.simple_expandable_list_item_1,
                numberList);
        listView.setAdapter(adapter);
        customizeDialog.setTitle("请选择分组");
        customizeDialog.setView(dialogView);
        final AlertDialog dia = customizeDialog.show();
        listView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView adapterView, View view, int i, long l) {
                dia.dismiss();
            }
        });

 

你可能感兴趣的:(Android开发)