compat/src/main/java/androidx/core/app/TaskStackBuilder.java
public void startActivities(@Nullable Bundle options) {
        if (mIntents.isEmpty()) {
            throw new IllegalStateException(
                    "No intents added to TaskStackBuilder; cannot startActivities");
        }

        Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]);
        intents[0] = new Intent(intents[0]).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
        if (!ContextCompat.startActivities(mSourceContext, intents, options)) {
            Intent topIntent = new Intent(intents[intents.length - 1]);
            topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mSourceContext.startActivity(topIntent);
        }
    }
/**
     * Start the task stack constructed by this builder. The Context used to obtain
     * this builder must be an Activity.
     *
     * <p>On devices that do not support API level 11 or higher the topmost activity
     * will be started as a new task. On devices that do support API level 11 or higher
     * the new task stack will be created in its entirety.</p>
     *
     * @param options Additional options for how the Activity should be started.
     * See {@link android.content.Context#startActivity(Intent, Bundle)}
     */
Start the task stack constructed by this builder. The Context used to obtain
this builder must be an Activity.

On devices that do not support API level 11 or higher the topmost activity
will be started as a new task. On devices that do support API level 11 or higher
the new task stack will be created in its entirety.

@param options Additional options for how the Activity should be started.
Start the task stack constructed by this builder . The Context used to obtain this builder must be an Activity . On devices that do not support API level 11 or higher the topmost activity will be started as a new task . On devices that do support API level 11 or higher the new task stack will be created in its entirety . @param options Additional options for how the Activity should be started .
public void startActivities(@Nullable Bundle options) {
        if (mIntents.isEmpty()) {
            throw new IllegalStateException(
                    "No intents added to TaskStackBuilder; cannot startActivities");
        }
        Intent[] intents = mIntents.toArray(new Intent[mIntents.size()]);
        intents[0] = new Intent(intents[0]).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_TASK_ON_HOME);
        if (!ContextCompat.startActivities(mSourceContext, intents, options)) {
            Intent topIntent = new Intent(intents[intents.length - 1]);
            topIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            mSourceContext.startActivity(topIntent);
        }
    }
public void startActivities ( @ Nullable Bundle options ) { if ( mIntents . isEmpty ( ) ) { throw new IllegalStateException ( "No intents added to TaskStackBuilder; cannot startActivities" ) ; } Intent [ ] intents = mIntents . toArray ( new Intent [ mIntents . size ( ) ] ) ; intents [ 0 ] = new Intent ( intents [ 0 ] ) . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK | Intent . FLAG_ACTIVITY_CLEAR_TASK | Intent . FLAG_ACTIVITY_TASK_ON_HOME ) ; if ( ! ContextCompat . startActivities ( mSourceContext , intents , options ) ) { Intent topIntent = new Intent ( intents [ intents . length - 1 ] ) ; topIntent . addFlags ( Intent . FLAG_ACTIVITY_NEW_TASK ) ; mSourceContext . startActivity ( topIntent ) ; } }
Start the task stack constructed by this builder.
Start the task stack constructed by this builder .