- // Get a handle for the `ListView` from `dialogFragment`.
- ListView folderListView = dialogFragment.getDialog().findViewById(R.id.move_to_folder_listview);
+ // Get the dialog from the dialog fragment.
+ Dialog dialog = dialogFragment.getDialog();
+
+ // Remove the incorrect lint warning below that the dialog might be null.
+ assert dialog != null;
+
+ // Get a handle for the list view from the dialog.
+ ListView folderListView = dialog.findViewById(R.id.move_to_folder_listview);