# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# MediaController2.Builder

`public static final class MediaController2.Builder`
`extends Object` ``

java.lang.Object
↳ | android.media.MediaController2.Builder

This API is not generally intended for third party application developers. Use the AndroidX Media2 session Library for consistent behavior across all devices.

Builder for `MediaController2`.

Any incoming event from the `MediaSession2` will be handled on the callback executor. If it's not set, `Context#getMainExecutor()` will be used by default.

## Summary

### Public constructors
`Builder(Context context, Session2Token token)` Creates a builder for `MediaController2`.

### Public methods
`MediaController2` | `build()` Build `MediaController2`.
`MediaController2.Builder` | `setConnectionHints(Bundle connectionHints)` Set the connection hints for the controller.
`MediaController2.Builder` | `setControllerCallback(Executor executor, MediaController2.ControllerCallback callback)` Set callback for the controller and its executor.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder (Context context,
                    Session2Token token)

Creates a builder for `MediaController2`.

Parameters
`context` | `Context`: context This value cannot be `null`.
`token` | `Session2Token`: token of the session to connect to This value cannot be `null`.

## Public methods

### build

    public MediaController2 build ()

Build `MediaController2`.

Returns
`MediaController2` | a new controller This value cannot be `null`.

### setConnectionHints

    public MediaController2.Builder setConnectionHints (Bundle connectionHints)

Set the connection hints for the controller.

`connectionHints` is a session-specific argument to send to the session when connecting. The contents of this bundle may affect the connection result.

An `IllegalArgumentException` will be thrown if the bundle contains any non-framework Parcelable objects.

Parameters
`connectionHints` | `Bundle`: a bundle which contains the connection hints This value cannot be `null`.

Returns
`MediaController2.Builder` | The Builder to allow chaining This value cannot be `null`.

### setControllerCallback

    public MediaController2.Builder setControllerCallback (Executor executor,
                    MediaController2.ControllerCallback callback)

Set callback for the controller and its executor.

Parameters
`executor` | `Executor`: callback executor This value cannot be `null`.
`callback` | `MediaController2.ControllerCallback`: session callback. This value cannot be `null`.

Returns
`MediaController2.Builder` | The Builder to allow chaining This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*