MediaMetadataCompat.Builder


public final class MediaMetadataCompat.Builder


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

Summary

Public constructors

Create an empty Builder.

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

Public methods

MediaMetadataCompat

Creates a MediaMetadataCompat instance with the specified fields.

MediaMetadataCompat.Builder
putBitmap(String key, Bitmap value)

Put a Bitmap into the metadata.

MediaMetadataCompat.Builder
putLong(String key, long value)

Put a long value into the metadata.

MediaMetadataCompat.Builder

Put a RatingCompat into the metadata.

MediaMetadataCompat.Builder
putString(String key, String value)

Put a String value into the metadata.

MediaMetadataCompat.Builder
putText(String key, CharSequence value)

Put a CharSequence value into the metadata.

Public constructors

Builder

Added in 1.1.0
public Builder()

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

Builder

Added in 1.1.0
public Builder(MediaMetadataCompat source)

Create a Builder using a MediaMetadataCompat 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
MediaMetadataCompat source

Public methods

build

Added in 1.1.0
public MediaMetadataCompat build()

Creates a MediaMetadataCompat instance with the specified fields.

Returns
MediaMetadataCompat

The new MediaMetadata instance

putBitmap

Added in 1.1.0
public MediaMetadataCompat.Builder putBitmap(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 setMetadata is called. To pass full resolution images Uris should be used with putString.
Parameters
String key

The key for referencing this value

Bitmap value

The Bitmap to store

Returns
MediaMetadataCompat.Builder

The Builder to allow chaining

putLong

Added in 1.1.0
public MediaMetadataCompat.Builder putLong(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
String key

The key for referencing this value

long value

The String value to store

Returns
MediaMetadataCompat.Builder

The Builder to allow chaining

putRating

Added in 1.1.0
public MediaMetadataCompat.Builder putRating(String key, RatingCompat value)

Put a RatingCompat 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
String key

The key for referencing this value

RatingCompat value

The String value to store

Returns
MediaMetadataCompat.Builder

The Builder to allow chaining

putString

Added in 1.1.0
public MediaMetadataCompat.Builder putString(String key, 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
String key

The key for referencing this value

String value

The String value to store

Returns
MediaMetadataCompat.Builder

The Builder to allow chaining

putText

Added in 1.1.0
public MediaMetadataCompat.Builder putText(String key, 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
String key

The key for referencing this value

CharSequence value

The CharSequence value to store

Returns
MediaMetadataCompat.Builder

The Builder to allow chaining