MediaMetadata.Builder

Added in 1.0.0
Deprecated in 1.3.0

public final class MediaMetadata.Builder


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

Summary

Public constructors

Create an empty Builder.

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

Public methods

@NonNull MediaMetadata

Creates a MediaMetadata instance with the specified fields.

@NonNull MediaMetadata.Builder

Put a Bitmap into the metadata.

@NonNull MediaMetadata.Builder
putFloat(@NonNull String key, float value)

Put a float value into the metadata.

@NonNull MediaMetadata.Builder
putLong(@NonNull String key, long value)

Put a long value into the metadata.

@NonNull MediaMetadata.Builder

Put a Rating into the metadata.

@NonNull MediaMetadata.Builder

Put a String value into the metadata.

@NonNull MediaMetadata.Builder

Put a CharSequence value into the metadata.

@NonNull MediaMetadata.Builder

Set a bundle of extras.

Public constructors

Builder

Added in 1.0.0
Deprecated in 1.3.0
public Builder()

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

Builder

Added in 1.0.0
Deprecated in 1.3.0
public Builder(@NonNull 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
@NonNull MediaMetadata source

Public methods

build

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata build()

Creates a MediaMetadata instance with the specified fields.

Returns
@NonNull MediaMetadata

The new MediaMetadatax instance

putBitmap

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putBitmap(@NonNull String key, @Nullable 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 Uris should be used with putString.
Parameters
@NonNull String key

The key for referencing this value

@Nullable Bitmap value

The Bitmap to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

putFloat

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putFloat(@NonNull String key, float value)

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

Parameters
@NonNull String key

The key for referencing this value

float value

The float value to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

putLong

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putLong(@NonNull 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
@NonNull String key

The key for referencing this value

long value

The String value to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

putRating

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putRating(@NonNull String key, @Nullable 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
@NonNull String key

The key for referencing this value

@Nullable Rating value

The String value to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

putString

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putString(@NonNull String key, @Nullable 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
@NonNull String key

The key for referencing this value

@Nullable String value

The String value to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

putText

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder putText(@NonNull String key, @Nullable 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
@NonNull String key

The key for referencing this value

@Nullable CharSequence value

The CharSequence value to store

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining

setExtras

Added in 1.0.0
Deprecated in 1.3.0
public @NonNull MediaMetadata.Builder setExtras(@Nullable Bundle extras)

Set a bundle of extras.

Parameters
@Nullable Bundle extras

The extras to include with this description or null.

Returns
@NonNull MediaMetadata.Builder

The Builder to allow chaining