Android Material对话框在关闭时不会关闭

时间:2019-06-26 18:29:03

标签: android dialog material

我正在使用dismiss方法,但是我的实质性对话没有结束

new MaterialDialog.Builder(MainActivity.this).adapter(mMaterialSimpleListAdapter, null).cancelable(true).autoDismiss(false).title("Select a device to pair").show();
MaterialSimpleListAdapter = new MaterialSimpleListAdapter(new MaterialSimpleListAdapter.Callback() {
            @Override
            public void onMaterialListItemSelected(MaterialDialog dialog, int index, MaterialSimpleListItem item) {
                if (mBluetoothAdapter != null) {
                    mBluetoothAdapter.stopLeScan(leScanCallback);
                }
                connectToDevice(((BluetoothDevice) item.getTag()),false);
                dialog.dismiss();
                loading.playAnimation();
                loading.setVisibility(View.VISIBLE);

            }
        });

我想念什么?

1 个答案:

答案 0 :(得分:0)

您是如何定义dialog.dismiss的“对话框”的?

MaterialDialog是一个外部库,所以我不知道它是如何工作的,但是尝试做这样的事情:

MaterialDialog.Builder builder = new MaterialDialog.Builder(this).adapter(mMaterialSimpleListAdapter, null).cancelable(true).autoDismiss(false).title("Select a device to pair");
dialog = builder.create();
dialog.show()