# Print output for @column tags ?> PictureInPictureParams.Builder - Android SDK | Android Developers

Most visited

Recently visited

PictureInPictureParams.Builder

public static class PictureInPictureParams.Builder
extends Object

java.lang.Object
   ↳ android.app.PictureInPictureParams.Builder


Builder class for PictureInPictureParams objects.

Summary

Public constructors

Builder()

Public methods

PictureInPictureParams build()
PictureInPictureParams.Builder setActions(List<RemoteAction> actions)

Sets the user actions.

PictureInPictureParams.Builder setAspectRatio(Rational aspectRatio)

Sets the aspect ratio.

PictureInPictureParams.Builder setAutoEnterEnabled(boolean autoEnterEnabled)

Sets whether the system will automatically put the activity in picture-in-picture mode without needing/waiting for the activity to call Activity#enterPictureInPictureMode(PictureInPictureParams).

PictureInPictureParams.Builder setSeamlessResizeEnabled(boolean seamlessResizeEnabled)

Sets whether the system can seamlessly resize the window while the activity is in picture-in-picture mode.

PictureInPictureParams.Builder setSourceRectHint(Rect launchBounds)

Sets the source bounds hint.

Inherited methods

Public constructors

Builder

public Builder ()

Public methods

build

public PictureInPictureParams build ()

Returns
PictureInPictureParams an immutable PictureInPictureParams to be used when entering or updating the activity in picture-in-picture.

See also:

setActions

public PictureInPictureParams.Builder setActions (List<RemoteAction> actions)

Sets the user actions. If there are more than Activity#getMaxNumPictureInPictureActions() actions, then the input list will be truncated to that number.

Parameters
actions List: the new actions to show in the picture-in-picture menu.

Returns
PictureInPictureParams.Builder this builder instance.

See also:

setAspectRatio

public PictureInPictureParams.Builder setAspectRatio (Rational aspectRatio)

Sets the aspect ratio. This aspect ratio is defined as the desired width / height, and does not change upon device rotation.

Parameters
aspectRatio Rational: the new aspect ratio for the activity in picture-in-picture, must be between 2.39:1 and 1:2.39 (inclusive).

Returns
PictureInPictureParams.Builder this builder instance.

setAutoEnterEnabled

public PictureInPictureParams.Builder setAutoEnterEnabled (boolean autoEnterEnabled)

Sets whether the system will automatically put the activity in picture-in-picture mode without needing/waiting for the activity to call Activity#enterPictureInPictureMode(PictureInPictureParams). If true, Activity#onPictureInPictureRequested() will never be called. This property is false by default.

Parameters
autoEnterEnabled boolean: true if the system will automatically put the activity in picture-in-picture mode.

Returns
PictureInPictureParams.Builder this builder instance. This value cannot be null.

setSeamlessResizeEnabled

public PictureInPictureParams.Builder setSeamlessResizeEnabled (boolean seamlessResizeEnabled)

Sets whether the system can seamlessly resize the window while the activity is in picture-in-picture mode. This should normally be the case for video content and when it's set to false, system will perform transitions to overcome the artifacts due to resize. This property is true by default for backwards compatibility.

Parameters
seamlessResizeEnabled boolean: true if the system can seamlessly resize the window while activity is in picture-in-picture mode.

Returns
PictureInPictureParams.Builder this builder instance. This value cannot be null.

setSourceRectHint

public PictureInPictureParams.Builder setSourceRectHint (Rect launchBounds)

Sets the source bounds hint. These bounds are only used when an activity first enters picture-in-picture, and describe the bounds in window coordinates of activity entering picture-in-picture that will be visible following the transition. For the best effect, these bounds should also match the aspect ratio in the arguments.

Parameters
launchBounds Rect: window-coordinate bounds indicating the area of the activity that will still be visible following the transition into picture-in-picture (eg. the video view bounds in a video player)

Returns
PictureInPictureParams.Builder this builder instance.