car/src/main/java/androidx/car/app/CarListDialog.java
public CarListDialog create() {
            // Check that the dialog was created with a list of either sections or items.
            if ((mSections == null || mSections.length == 0)
                    && (mItems == null || mItems.length == 0)) {
                throw new IllegalStateException(
                        "CarListDialog cannot be created with a non-empty list.");
            }

            int numOfItems = 0;

            // Subsections take precedent over items as both cannot be set at the same time.
            if (mSections != null) {
                mItems = null;

                // Calculate the total number of items by adding up all the sections.
                for (DialogSubSection section : mSections) {
                    numOfItems += section.getItemCount();
                }
            } else {
                numOfItems = mItems.length;
            }

            if (mInitialPosition >= numOfItems) {
                throw new IllegalStateException("Initial position is greater than the number of "
                        + "items in the list.");
            }

            CarListDialog dialog = new CarListDialog(mContext, /* builder= */ this);

            dialog.setCancelable(mCancelable);
            dialog.setCanceledOnTouchOutside(mCancelable);
            dialog.setOnCancelListener(mOnCancelListener);
            dialog.setOnDismissListener(mOnDismissListener);

            return dialog;
        }
/**
         * Creates an {@link CarListDialog} with the arguments supplied to this {@code Builder}.
         *
         * <p>If {@link #setItems(String[],DialogInterface.OnClickListener)} is never called, then
         * calling this method will throw an exception.
         *
         * <p>Calling this method does not display the dialog. Utilize this dialog within a
         * {@link androidx.fragment.app.DialogFragment} to show the dialog.
         */
Creates an  CarListDialog with the arguments supplied to this  Builder.
If  #setItems(String[],DialogInterface.OnClickListener) is never called, then
calling this method will throw an exception.

Calling this method does not display the dialog. Utilize this dialog within a
androidx.fragment.app.DialogFragment to show the dialog.
Creates an CarListDialog with the arguments supplied to this Builder . If #setItems ( String [] DialogInterface . OnClickListener ) is never called then calling this method will throw an exception . Calling this method does not display the dialog . Utilize this dialog within a androidx . fragment . app . DialogFragment to show the dialog .
public CarListDialog create() {
            if ((mSections == null || mSections.length == 0)
                    && (mItems == null || mItems.length == 0)) {
                throw new IllegalStateException(
                        "CarListDialog cannot be created with a non-empty list.");
            }
            int numOfItems = 0;
            if (mSections != null) {
                mItems = null;
                for (DialogSubSection section : mSections) {
                    numOfItems += section.getItemCount();
                }
            } else {
                numOfItems = mItems.length;
            }
            if (mInitialPosition >= numOfItems) {
                throw new IllegalStateException("Initial position is greater than the number of "
                        + "items in the list.");
            }
            CarListDialog dialog = new CarListDialog(mContext, /* builder= */ this);
            dialog.setCancelable(mCancelable);
            dialog.setCanceledOnTouchOutside(mCancelable);
            dialog.setOnCancelListener(mOnCancelListener);
            dialog.setOnDismissListener(mOnDismissListener);
            return dialog;
        }
public CarListDialog create ( ) { if ( ( mSections == null || mSections . length == 0 ) && ( mItems == null || mItems . length == 0 ) ) { throw new IllegalStateException ( "CarListDialog cannot be created with a non-empty list." ) ; } int numOfItems = 0 ; if ( mSections != null ) { mItems = null ; for ( DialogSubSection section : mSections ) { numOfItems += section . getItemCount ( ) ; } } else { numOfItems = mItems . length ; } if ( mInitialPosition >= numOfItems ) { throw new IllegalStateException ( "Initial position is greater than the number of " + "items in the list." ) ; } CarListDialog dialog = new CarListDialog ( mContext , /* builder= */ this ) ; dialog . setCancelable ( mCancelable ) ; dialog . setCanceledOnTouchOutside ( mCancelable ) ; dialog . setOnCancelListener ( mOnCancelListener ) ; dialog . setOnDismissListener ( mOnDismissListener ) ; return dialog ; }
Creates an {@link CarListDialog} with the arguments supplied to this {@code Builder}.
Creates an { @link CarListDialog } with the arguments supplied to this { @code Builder } .
// Check that the dialog was created with a list of either sections or items. // Subsections take precedent over items as both cannot be set at the same time. // Calculate the total number of items by adding up all the sections.