code: private void attachAdapter() {
          if (listView != null) {
              if (adapter != null) {
                  listView.setHasFixedSize(false);
                  listView.setLayoutManager(layoutManager);
                  listView.setAdapter(adapter);
                  listView.setVisibility(adapter != null ? View.VISIBLE : View.GONE);
                  adapter.setOnItemSelectedListener(listViewItemSelectedListener);
                  initializeSelectionListener();
                  initializeCheckedItems();
                  adaptItemColor();
                  adaptItemTypeface();
              } else {
                  if (inflatedCustomView) {
                      getDialog().setView(null);
                  }
  
                  listView = null;
              }
          }
      }
docs: Attaches the adapter to the dialog's list view.