Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# MetadataEditor

*** ** * ** ***

```
open class MetadataEditor : MediaMetadataEditor
```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) |||
| ↳ | [android.media.MediaMetadataEditor](https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor) ||
|   | ↳ | [android.media.RemoteControlClient.MetadataEditor](https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#) |

*** ** * ** ***

> [!CAUTION]
> **This class was deprecated in API level 21.**
>
> Use `https://developer.android.com/reference/kotlin/android/media/MediaMetadata` and `https://developer.android.com/reference/kotlin/android/media/session/MediaSession` instead.

Class used to modify metadata in a `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient` object. Use `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient#editMetadata(kotlin.Boolean)` to create an instance of an editor, on which you set the metadata for the RemoteControlClient instance. Once all the information has been set, use `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#apply()` to make it the new metadata that should be displayed for the associated client. Once the metadata has been "applied", you cannot reuse this instance of the MetadataEditor.

## Summary

| Constants ||
|---|---|
| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#BITMAP_KEY_ARTWORK:kotlin.Int` The metadata key for the content artwork / album art. |

| Inherited constants ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#RATING_KEY_BY_OTHERS:kotlin.Int` The metadata key for the content's average rating, not the user's rating. The value associated with this key is a `https://developer.android.com/reference/kotlin/android/media/Rating` instance. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#RATING_KEY_BY_USER:kotlin.Int` The metadata key for the content's user rating. The value associated with this key is a `https://developer.android.com/reference/kotlin/android/media/Rating` instance. This key can be flagged as "editable" (with `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#addEditableKey(kotlin.Int)`) to enable receiving user rating values through the `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.OnMetadataUpdateListener` interface. <br /> | ||

| Public methods ||
|---|---|
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#apply()()` Associates all the metadata that has been set since the MetadataEditor instance was created with `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient#editMetadata(kotlin.Boolean)`, or since `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#clear()` was called, with the RemoteControlClient. |
| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#clear()()` Clears all the metadata that has been set since the MetadataEditor instance was created (with `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient#editMetadata(kotlin.Boolean)`). |
| open [Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)! | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#clone()()` Creates and returns a copy of this object. |
| open [RemoteControlClient.MetadataEditor](https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#)! | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#putBitmap(kotlin.Int,%20android.graphics.Bitmap)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, bitmap: https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#!)` Sets the album / artwork picture to be displayed on the remote control. |
| open [RemoteControlClient.MetadataEditor](https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#)! | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#putLong(kotlin.Int,%20kotlin.Long)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Adds numerical information to be displayed. |
| open [RemoteControlClient.MetadataEditor](https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#)! | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#putObject(kotlin.Int,%20kotlin.Any)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, object: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!)` Adds information stored as an instance. |
| open [RemoteControlClient.MetadataEditor](https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#)! | `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#putString(kotlin.Int,%20kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, value: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Adds textual information to be displayed. |

| Inherited functions ||
|---|---|
| From class `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor` |---|---| | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#addEditableKey(kotlin.Int)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)` Flags the given key as being editable. This should only be used by metadata publishers, such as `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient`, which will declare the metadata field as eligible to be updated, with new values received through the `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.OnMetadataUpdateListener` interface. <br /> | | `https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#!` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#getBitmap(kotlin.Int,%20android.graphics.Bitmap)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, defaultValue: https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#!)` Returns the `https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#` value for the key. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int-array/index.html!` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#getEditableKeys()()` Retrieves the keys flagged as editable. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#getLong(kotlin.Int,%20kotlin.Long)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, defaultValue: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html)` Returns the long value for the key. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#getObject(kotlin.Int,%20kotlin.Any)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, defaultValue: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!)` Returns an object representation of the value for the key <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#getString(kotlin.Int,%20kotlin.String)(key: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html, defaultValue: https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html!)` Returns the `https://developer.android.com/reference/kotlin/java/lang/String.html#` value for the key. <br /> | | `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#removeEditableKeys()()` Causes all metadata fields to be read-only. <br /> | ||

## Constants

### BITMAP_KEY_ARTWORK

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
static val BITMAP_KEY_ARTWORK: Int
```

**Deprecated:** *Deprecated in Java.*

The metadata key for the content artwork / album art.

    Value: 100

## Public methods

### apply

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun apply(): Unit
```

**Deprecated:** *Deprecated in Java.*

Associates all the metadata that has been set since the MetadataEditor instance was created with `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient#editMetadata(kotlin.Boolean)`, or since `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#clear()` was called, with the RemoteControlClient. Once "applied", this MetadataEditor cannot be reused to edit the RemoteControlClient's metadata.

### clear

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clear(): Unit
```

**Deprecated:** *Deprecated in Java.*

Clears all the metadata that has been set since the MetadataEditor instance was created (with `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient#editMetadata(kotlin.Boolean)`). Note that clearing the metadata doesn't reset the editable keys (use `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#removeEditableKeys()` instead).

### clone

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun clone(): Any!
```

**Deprecated:** *Deprecated in Java.*

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object `x`, the expression:

```kotlin
x.clone() != x
```
will be true, and that the expression:

```kotlin
x.clone().getClass() == x.getClass()
```
will be `true`, but these are not absolute requirements. While it is typically the case that:

```kotlin
x.clone().equals(x)
```
will be `true`, this is not an absolute requirement.

<br />

By convention, the returned object should be obtained by calling `super.clone`. If a class and all of its superclasses (except `Object`) obey this convention, it will be the case that `x.clone().getClass() == x.getClass()`.

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by `super.clone` before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by `super.clone` need to be modified.

| Return ||
|---|---|
| `https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html!` | a clone of this instance. |

| Exceptions ||
|---|---|
| `java.lang.CloneNotSupportedException` | if the object's class does not support the `Cloneable` interface. Subclasses that override the `clone` method can also throw this exception to indicate that an instance cannot be cloned. |

### putBitmap

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun putBitmap(
    key: Int, 
    bitmap: Bitmap!
): RemoteControlClient.MetadataEditor!
```

**Deprecated:** *Deprecated in Java.*

Sets the album / artwork picture to be displayed on the remote control.

| Parameters ||
|---|---|
| `key` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the identifier of the bitmap to set. The only valid value is `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#BITMAP_KEY_ARTWORK:kotlin.Int` |
| `bitmap` | [Bitmap](https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#)!: The bitmap for the artwork, or null if there isn't any. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#!` | Returns a reference to the same MetadataEditor object, so you can chain put calls together. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` |   |

**See Also**

- `https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#`

### putLong

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun putLong(
    key: Int, 
    value: Long
): RemoteControlClient.MetadataEditor!
```

**Deprecated:** *Deprecated in Java.*

Adds numerical information to be displayed. Note that none of the information added after `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#apply()` has been called, will be displayed.

| Parameters ||
|---|---|
| `key` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the identifier of a the metadata field to set. Valid values are `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_CD_TRACK_NUMBER:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_DISC_NUMBER:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_DURATION:kotlin.Int` (with a value expressed in milliseconds), `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_YEAR:kotlin.Int`. |
| `value` | [Long](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-long/index.html): The long value for the given key |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#!` | Returns a reference to the same MetadataEditor object, so you can chain put calls together. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` |   |

### putObject

Added in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  
Deprecated in [API level 21](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun putObject(
    key: Int, 
    object: Any!
): RemoteControlClient.MetadataEditor!
```

**Deprecated:** *Deprecated in Java.*

Adds information stored as an instance. Note that none of the information added after `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#apply()` has been called will be available to consumers of metadata stored by the MediaMetadataEditor.

| Parameters ||
|---|---|
| `key` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): the identifier of a the metadata field to set. Valid keys for a: - `https://developer.android.com/reference/kotlin/android/graphics/Bitmap.html#` object are `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#BITMAP_KEY_ARTWORK:kotlin.Int`, - `https://developer.android.com/reference/kotlin/java/lang/String.html#` object are the same as for `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#putString(kotlin.Int,%20kotlin.String)` - `https://developer.android.com/reference/kotlin/java/lang/Long.html#` object are the same as for `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#putLong(kotlin.Int,%20kotlin.Long)` - `https://developer.android.com/reference/kotlin/android/media/Rating` object are `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#RATING_KEY_BY_OTHERS:kotlin.Int` and `https://developer.android.com/reference/kotlin/android/media/MediaMetadataEditor#RATING_KEY_BY_USER:kotlin.Int`. |
| `value` | the metadata to add. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#!` | Returns a reference to the same MediaMetadataEditor object, so you can chain put calls together. |

| Exceptions ||
|---|---|
| `java.lang.IllegalArgumentException` |   |

### putString

Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

```
open fun putString(
    key: Int, 
    value: String!
): RemoteControlClient.MetadataEditor!
```

**Deprecated:** *Deprecated in Java.*

Adds textual information to be displayed. Note that none of the information added after `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#apply()` has been called, will be displayed.

| Parameters ||
|---|---|
| `key` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The identifier of a the metadata field to set. Valid values are `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_ALBUM:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_ALBUMARTIST:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_TITLE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_ARTIST:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_AUTHOR:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_COMPILATION:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_COMPOSER:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_DATE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_GENRE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_TITLE:kotlin.Int`, `https://developer.android.com/reference/kotlin/android/media/MediaMetadataRetriever#METADATA_KEY_WRITER:kotlin.Int`. |
| `value` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The text for the given key, or `null` to signify there is no valid information for the field. |

| Return ||
|---|---|
| `https://developer.android.com/reference/kotlin/android/media/RemoteControlClient.MetadataEditor#!` | Returns a reference to the same MetadataEditor object, so you can chain put calls together. |