# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# MediaMetadata.Builder

`public static final class MediaMetadata.Builder`
`extends Object` ``

java.lang.Object
↳ | android.media.MediaMetadata.Builder

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

## Summary

### Public constructors
`Builder()` Create an empty Builder.
`Builder(MediaMetadata source)` Create a Builder using a `MediaMetadata` instance to set the initial values.

### Public methods
`MediaMetadata` | `build()` Creates a `MediaMetadata` instance with the specified fields.
`MediaMetadata.Builder` | `putBitmap(String key, Bitmap value)` Put a `Bitmap` into the metadata.
`MediaMetadata.Builder` | `putLong(String key, long value)` Put a long value into the metadata.
`MediaMetadata.Builder` | `putRating(String key, Rating value)` Put a `Rating` into the metadata.
`MediaMetadata.Builder` | `putString(String key, String value)` Put a String value into the metadata.
`MediaMetadata.Builder` | `putText(String key, CharSequence value)` Put a CharSequence value into the metadata.
`MediaMetadata.Builder` | `setBitmapDimensionLimit(int bitmapDimensionLimit)` Sets the maximum width/height (in pixels) for the bitmaps in the metadata.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public constructors

### Builder

    public Builder ()

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

### Builder

    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.

## Public methods

### build

    public MediaMetadata build ()

Creates a `MediaMetadata` instance with the specified fields.

Returns
`MediaMetadata` | The new MediaMetadata instance

### putBitmap

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

- `MediaMetadata.METADATA_KEY_ART`
- `MediaMetadata.METADATA_KEY_ALBUM_ART`
- `MediaMetadata.METADATA_KEY_DISPLAY_ICON`

Large bitmaps may be scaled down by the system with `Builder#setBitmapDimensionLimit(int)` when `MediaSession#setMetadata` is called. To pass full resolution images `Uris` should be used with `putString(String, String)`.

Parameters
`key` | `String`: The key for referencing this value Value is `MediaMetadata.METADATA_KEY_ART`, `MediaMetadata.METADATA_KEY_ALBUM_ART`, or `MediaMetadata.METADATA_KEY_DISPLAY_ICON`
`value` | `Bitmap`: The Bitmap to store

Returns
`MediaMetadata.Builder` | The Builder to allow chaining

### putLong

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

- `MediaMetadata.METADATA_KEY_DURATION`
- `MediaMetadata.METADATA_KEY_TRACK_NUMBER`
- `MediaMetadata.METADATA_KEY_NUM_TRACKS`
- `MediaMetadata.METADATA_KEY_DISC_NUMBER`
- `MediaMetadata.METADATA_KEY_YEAR`

Parameters
`key` | `String`: The key for referencing this value Value is `MediaMetadata.METADATA_KEY_DURATION`, `MediaMetadata.METADATA_KEY_YEAR`, `MediaMetadata.METADATA_KEY_TRACK_NUMBER`, `MediaMetadata.METADATA_KEY_NUM_TRACKS`, `MediaMetadata.METADATA_KEY_DISC_NUMBER`, or `MediaMetadata.METADATA_KEY_BT_FOLDER_TYPE`
`value` | `long`: The long value to store

Returns
`MediaMetadata.Builder` | The Builder to allow chaining

### putRating

    public MediaMetadata.Builder putRating (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:

- `MediaMetadata.METADATA_KEY_RATING`
- `MediaMetadata.METADATA_KEY_USER_RATING`

Parameters
`key` | `String`: The key for referencing this value Value is `MediaMetadata.METADATA_KEY_USER_RATING`, or `MediaMetadata.METADATA_KEY_RATING`
`value` | `Rating`: The Rating value to store

Returns
`MediaMetadata.Builder` | The Builder to allow chaining

### putString

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

- `MediaMetadata.METADATA_KEY_TITLE`
- `MediaMetadata.METADATA_KEY_ARTIST`
- `MediaMetadata.METADATA_KEY_ALBUM`
- `MediaMetadata.METADATA_KEY_AUTHOR`
- `MediaMetadata.METADATA_KEY_WRITER`
- `MediaMetadata.METADATA_KEY_COMPOSER`
- `MediaMetadata.METADATA_KEY_DATE`
- `MediaMetadata.METADATA_KEY_GENRE`
- `MediaMetadata.METADATA_KEY_ALBUM_ARTIST`
- `MediaMetadata.METADATA_KEY_ART_URI`
- `MediaMetadata.METADATA_KEY_ALBUM_ART_URI`
- `MediaMetadata.METADATA_KEY_DISPLAY_TITLE`
- `MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE`
- `MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION`
- `MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI`

Uris for artwork should use the content:// style and support `ContentResolver#EXTRA_SIZE` for retrieving scaled artwork through `ContentResolver#openTypedAssetFileDescriptor(Uri, String, Bundle)`.

Parameters
`key` | `String`: The key for referencing this value Value is `MediaMetadata.METADATA_KEY_TITLE`, `MediaMetadata.METADATA_KEY_ARTIST`, `MediaMetadata.METADATA_KEY_ALBUM`, `MediaMetadata.METADATA_KEY_AUTHOR`, `MediaMetadata.METADATA_KEY_WRITER`, `MediaMetadata.METADATA_KEY_COMPOSER`, `MediaMetadata.METADATA_KEY_COMPILATION`, `MediaMetadata.METADATA_KEY_DATE`, `MediaMetadata.METADATA_KEY_GENRE`, `MediaMetadata.METADATA_KEY_ALBUM_ARTIST`, `MediaMetadata.METADATA_KEY_ART_URI`, `MediaMetadata.METADATA_KEY_ALBUM_ART_URI`, `MediaMetadata.METADATA_KEY_DISPLAY_TITLE`, `MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE`, `MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION`, `MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI`, `MediaMetadata.METADATA_KEY_MEDIA_ID`, or `MediaMetadata.METADATA_KEY_MEDIA_URI`
`value` | `String`: The String value to store

Returns
`MediaMetadata.Builder` | The Builder to allow chaining

### putText

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

- `MediaMetadata.METADATA_KEY_TITLE`
- `MediaMetadata.METADATA_KEY_ARTIST`
- `MediaMetadata.METADATA_KEY_ALBUM`
- `MediaMetadata.METADATA_KEY_AUTHOR`
- `MediaMetadata.METADATA_KEY_WRITER`
- `MediaMetadata.METADATA_KEY_COMPOSER`
- `MediaMetadata.METADATA_KEY_DATE`
- `MediaMetadata.METADATA_KEY_GENRE`
- `MediaMetadata.METADATA_KEY_ALBUM_ARTIST`
- `MediaMetadata.METADATA_KEY_ART_URI`
- `MediaMetadata.METADATA_KEY_ALBUM_ART_URI`
- `MediaMetadata.METADATA_KEY_DISPLAY_TITLE`
- `MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE`
- `MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION`
- `MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI`

Parameters
`key` | `String`: The key for referencing this value Value is `MediaMetadata.METADATA_KEY_TITLE`, `MediaMetadata.METADATA_KEY_ARTIST`, `MediaMetadata.METADATA_KEY_ALBUM`, `MediaMetadata.METADATA_KEY_AUTHOR`, `MediaMetadata.METADATA_KEY_WRITER`, `MediaMetadata.METADATA_KEY_COMPOSER`, `MediaMetadata.METADATA_KEY_COMPILATION`, `MediaMetadata.METADATA_KEY_DATE`, `MediaMetadata.METADATA_KEY_GENRE`, `MediaMetadata.METADATA_KEY_ALBUM_ARTIST`, `MediaMetadata.METADATA_KEY_ART_URI`, `MediaMetadata.METADATA_KEY_ALBUM_ART_URI`, `MediaMetadata.METADATA_KEY_DISPLAY_TITLE`, `MediaMetadata.METADATA_KEY_DISPLAY_SUBTITLE`, `MediaMetadata.METADATA_KEY_DISPLAY_DESCRIPTION`, `MediaMetadata.METADATA_KEY_DISPLAY_ICON_URI`, `MediaMetadata.METADATA_KEY_MEDIA_ID`, or `MediaMetadata.METADATA_KEY_MEDIA_URI`
`value` | `CharSequence`: The CharSequence value to store

Returns
`MediaMetadata.Builder` | The Builder to allow chaining

### setBitmapDimensionLimit

    public MediaMetadata.Builder setBitmapDimensionLimit (int bitmapDimensionLimit)

Sets the maximum width/height (in pixels) for the bitmaps in the metadata. Bitmaps will be replaced with scaled down copies if their width (or height) is larger than `bitmapDimensionLimit`.

In order to unset the limit, pass `Integer#MAX_VALUE` as `bitmapDimensionLimit`.

Parameters
`bitmapDimensionLimit` | `int`: The maximum width/height (in pixels) for bitmaps contained in the metadata. Non-positive values are ignored. Pass `Integer#MAX_VALUE` to unset the limit. Value is 1 or greater

Returns
`MediaMetadata.Builder` | This value cannot be `null`.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*