Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)   
Deprecated in [API level 37](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#pubctors) \| [Methods](https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#inhmethods)

# Session2CommandGroup.Builder

*** ** * ** ***

` public static final class Session2CommandGroup.Builder `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.media.Session2CommandGroup.Builder |

<br />

*** ** * ** ***

<br />

**This class was deprecated in API level 37.**   

Use the Media3 support library instead.

This API is not generally intended for third party application developers. Use the [AndroidX](https://developer.android.com/jetpack/androidx) [Media3 session Library](https://developer.android.com/media/media3/session/control-playback) for consistent behavior across all devices.

Builds a `https://developer.android.com/reference/android/media/Session2CommandGroup` object.

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#Builder()() ` |
| ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#Builder(android.media.Session2CommandGroup)(https://developer.android.com/reference/android/media/Session2CommandGroup commandGroup) ` Creates a new builder for `https://developer.android.com/reference/android/media/Session2CommandGroup` with commands copied from another `https://developer.android.com/reference/android/media/Session2CommandGroup` object. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder` | ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#addCommand(android.media.Session2Command)(https://developer.android.com/reference/android/media/Session2Command command) ` Adds a command to this command group. |
| ` https://developer.android.com/reference/android/media/Session2CommandGroup` | ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#build()() ` Builds `https://developer.android.com/reference/android/media/Session2CommandGroup`. |
| ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder` | ` https://developer.android.com/reference/android/media/Session2CommandGroup.Builder#removeCommand(android.media.Session2Command)(https://developer.android.com/reference/android/media/Session2Command command) ` Removes a command from this group which matches given `command`. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.

## Public constructors

### Builder

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder ()
```

<br />

<br />

### Builder

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Builder (Session2CommandGroup commandGroup)
```

Creates a new builder for `https://developer.android.com/reference/android/media/Session2CommandGroup` with commands copied from another `https://developer.android.com/reference/android/media/Session2CommandGroup` object.

<br />

| Parameters ||
|---|---|
| `commandGroup` | `Session2CommandGroup`: This value cannot be `null`. <br /> |

## Public methods

### addCommand

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Session2CommandGroup.Builder addCommand (Session2Command command)
```

Adds a command to this command group.

<br />

| Parameters ||
|---|---|
| `command` | `Session2Command`: A command to add. Shouldn't be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/Session2CommandGroup.Builder` | This value cannot be `null`. <br /> |

### build

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Session2CommandGroup build ()
```

Builds `https://developer.android.com/reference/android/media/Session2CommandGroup`.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/Session2CommandGroup` | a new `https://developer.android.com/reference/android/media/Session2CommandGroup`. This value cannot be `null`. <br /> |

### removeCommand

Added in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Session2CommandGroup.Builder removeCommand (Session2Command command)
```

Removes a command from this group which matches given `command`.

<br />

| Parameters ||
|---|---|
| `command` | `Session2Command`: A command to find. Shouldn't be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/media/Session2CommandGroup.Builder` | This value cannot be `null`. <br /> |