MediaMetadata.Builder

Added in 1.0.0
Deprecated in 1.3.0

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 functions

MediaMetadata

Creates a MediaMetadata instance with the specified fields.

MediaMetadata.Builder
putBitmap(key: String, value: Bitmap?)

Put a Bitmap into the metadata.

MediaMetadata.Builder
putFloat(key: String, value: Float)

Put a float value into the metadata.

MediaMetadata.Builder
putLong(key: String, value: Long)

Put a long value into the metadata.

MediaMetadata.Builder
putRating(key: String, value: Rating?)

Put a Rating into the metadata.

MediaMetadata.Builder
putString(key: String, value: String?)

Put a String value into the metadata.

MediaMetadata.Builder
putText(key: String, value: CharSequence?)

Put a CharSequence value into the metadata.

MediaMetadata.Builder
setExtras(extras: Bundle?)

Set a bundle of extras.

Public constructors

Builder

Added in 1.0.0
Deprecated in 1.3.0
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
Builder(source: MediaMetadata)

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: MediaMetadata

Public functions

build

Added in 1.0.0
Deprecated in 1.3.0
fun build(): MediaMetadata

Creates a MediaMetadata instance with the specified fields.

Returns
MediaMetadata

The new MediaMetadatax instance

putBitmap

Added in 1.0.0
Deprecated in 1.3.0
fun putBitmap(key: String, value: Bitmap?): MediaMetadata.Builder

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
key: String

The key for referencing this value

value: Bitmap?

The Bitmap to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

putFloat

Added in 1.0.0
Deprecated in 1.3.0
fun putFloat(key: String, value: Float): MediaMetadata.Builder

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

Parameters
key: String

The key for referencing this value

value: Float

The float value to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

putLong

Added in 1.0.0
Deprecated in 1.3.0
fun putLong(key: String, value: Long): MediaMetadata.Builder

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: String

The key for referencing this value

value: Long

The String value to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

putRating

Added in 1.0.0
Deprecated in 1.3.0
fun putRating(key: String, value: Rating?): MediaMetadata.Builder

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: String

The key for referencing this value

value: Rating?

The String value to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

putString

Added in 1.0.0
Deprecated in 1.3.0
fun putString(key: String, value: String?): MediaMetadata.Builder

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: String

The key for referencing this value

value: String?

The String value to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

putText

Added in 1.0.0
Deprecated in 1.3.0
fun putText(key: String, value: CharSequence?): MediaMetadata.Builder

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: String

The key for referencing this value

value: CharSequence?

The CharSequence value to store

Returns
MediaMetadata.Builder

The Builder to allow chaining

setExtras

Added in 1.0.0
Deprecated in 1.3.0
fun setExtras(extras: Bundle?): MediaMetadata.Builder

Set a bundle of extras.

Parameters
extras: Bundle?

The extras to include with this description or null.

Returns
MediaMetadata.Builder

The Builder to allow chaining