public final class

SessionCommandGroup.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media2.SessionCommandGroup.Builder

Overview

Builds a SessionCommandGroup object.

Summary

Constructors
publicBuilder()

publicBuilder(SessionCommandGroup commandGroup)

Creates a new builder for SessionCommandGroup with commands copied from another SessionCommandGroup object.

Methods
public SessionCommandGroup.BuilderaddAllPredefinedCommands(int version)

Adds all predefined session commands except for the commands added after the specified version without default implementation.

public SessionCommandGroup.BuilderaddCommand(int commandCode)

Adds a predefined command with given commandCode to this command group.

public SessionCommandGroup.BuilderaddCommand(SessionCommand command)

Adds a command to this command group.

public SessionCommandGroupbuild()

Builds SessionCommandGroup.

public SessionCommandGroup.BuilderremoveCommand(int commandCode)

Removes a command from this group which matches given commandCode.

public SessionCommandGroup.BuilderremoveCommand(SessionCommand command)

Removes a command from this group which matches given command.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public Builder()

public Builder(SessionCommandGroup commandGroup)

Creates a new builder for SessionCommandGroup with commands copied from another SessionCommandGroup object.

Parameters:

commandGroup:

Methods

public SessionCommandGroup.Builder addCommand(SessionCommand command)

Adds a command to this command group.

Parameters:

command: A command to add. Shouldn't be null.

public SessionCommandGroup.Builder addCommand(int commandCode)

Adds a predefined command with given commandCode to this command group.

Parameters:

commandCode: A command code to add. Shouldn't be SessionCommand.COMMAND_CODE_CUSTOM.

public SessionCommandGroup.Builder addAllPredefinedCommands(int version)

Adds all predefined session commands except for the commands added after the specified version without default implementation. This provides convenient way to add commands with implementation.

When you update support library version, it's recommended to take a look SessionCommand to double check whether this only adds commands that you want. You may increase the version here.

Parameters:

version: command version

See also: SessionCommand.COMMAND_VERSION_1, MediaSession.SessionCallback.onConnect(MediaSession, MediaSession.ControllerInfo)

public SessionCommandGroup.Builder removeCommand(SessionCommand command)

Removes a command from this group which matches given command.

Parameters:

command: A command to find. Shouldn't be null.

public SessionCommandGroup.Builder removeCommand(int commandCode)

Removes a command from this group which matches given commandCode.

Parameters:

commandCode: A command code to find. Shouldn't be SessionCommand.COMMAND_CODE_CUSTOM.

public SessionCommandGroup build()

Builds SessionCommandGroup.

Returns:

a new SessionCommandGroup.