public final class

MediaMetadata.Builder

extends java.lang.Object

 java.lang.Object

↳androidx.media2.common.MediaMetadata.Builder

Overview

Use to build MediaMetadatax objects. The system defined metadata keys must use the appropriate data type.

Summary

Constructors
publicBuilder()

Create an empty Builder.

publicBuilder(MediaMetadata source)

Create a Builder using a MediaMetadata instance to set the initial values.

Methods
public MediaMetadatabuild()

Creates a MediaMetadata instance with the specified fields.

public MediaMetadata.BuilderputBitmap(java.lang.String key, Bitmap value)

Put a Bitmap into the metadata.

public MediaMetadata.BuilderputFloat(java.lang.String key, float value)

Put a float value into the metadata.

public MediaMetadata.BuilderputLong(java.lang.String key, long value)

Put a long value into the metadata.

public MediaMetadata.BuilderputRating(java.lang.String key, Rating value)

Put a Rating into the metadata.

public MediaMetadata.BuilderputString(java.lang.String key, java.lang.String value)

Put a String value into the metadata.

public MediaMetadata.BuilderputText(java.lang.String key, java.lang.CharSequence value)

Put a CharSequence value into the metadata.

public MediaMetadata.BuildersetExtras(Bundle extras)

Set a bundle of extras.

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

Constructors

public Builder()

Create an empty Builder. Any field that should be included in the MediaMetadata must be added.

public Builder(MediaMetadata source)

Create a Builder using a MediaMetadata instance to set the initial values. All fields in the source metadata will be included in the new metadata. Fields can be overwritten by adding the same key.

Parameters:

source:

Methods

public MediaMetadata.Builder putText(java.lang.String key, java.lang.CharSequence value)

Put a CharSequence value into the metadata. Custom keys may be used, but if the METADATA_KEYs defined in this class are used they may only be one of the following:

Parameters:

key: The key for referencing this value
value: The CharSequence value to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder putString(java.lang.String key, java.lang.String value)

Put a String value into the metadata. Custom keys may be used, but if the METADATA_KEYs defined in this class are used they may only be one of the following:

Parameters:

key: The key for referencing this value
value: The String value to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder putLong(java.lang.String key, long value)

Put a long value into the metadata. Custom keys may be used, but if the METADATA_KEYs defined in this class are used they may only be one of the following:

Parameters:

key: The key for referencing this value
value: The String value to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder putRating(java.lang.String key, Rating value)

Put a Rating into the metadata. Custom keys may be used, but if the METADATA_KEYs defined in this class are used they may only be one of the following:

Parameters:

key: The key for referencing this value
value: The String value to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder putBitmap(java.lang.String key, Bitmap value)

Put a Bitmap into the metadata. Custom keys may be used, but if the METADATA_KEYs defined in this class are used they may only be one of the following:

Large bitmaps may be scaled down when it is passed to the other process. To pass full resolution images should be used with MediaMetadata.Builder.putString(String, String).

Parameters:

key: The key for referencing this value
value: The Bitmap to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder putFloat(java.lang.String key, float value)

Put a float value into the metadata. Custom keys may be used.

Parameters:

key: The key for referencing this value
value: The float value to store

Returns:

The Builder to allow chaining

public MediaMetadata.Builder setExtras(Bundle extras)

Set a bundle of extras.

Parameters:

extras: The extras to include with this description or null.

Returns:

The Builder to allow chaining

public MediaMetadata build()

Creates a MediaMetadata instance with the specified fields.

Returns:

The new MediaMetadatax instance