Added in API level 19
Deprecated in API level 21

MediaMetadataEditor


abstract class MediaMetadataEditor
kotlin.Any
   ↳ android.media.MediaMetadataEditor

An abstract class for editing and storing metadata that can be published by RemoteControlClient. See the RemoteControlClient#editMetadata(boolean) method to instantiate a RemoteControlClient.MetadataEditor object.

Summary

Constants
static Int

The metadata key for the content artwork / album art.

static Int

The metadata key for the content's average rating, not the user's rating.

static Int

The metadata key for the content's user rating.

Public methods
open Unit

Flags the given key as being editable.

abstract Unit

Applies all of the metadata changes that have been set since the MediaMetadataEditor instance was created or since clear() was called.

open Unit

Clears all the pending metadata changes set since the MediaMetadataEditor instance was created or since this method was last called.

open Bitmap!
getBitmap(key: Int, defaultValue: Bitmap!)

Returns the Bitmap value for the key.

open IntArray!

Retrieves the keys flagged as editable.

open Long
getLong(key: Int, defaultValue: Long)

Returns the long value for the key.

open Any!
getObject(key: Int, defaultValue: Any!)

Returns an object representation of the value for the key

open String!
getString(key: Int, defaultValue: String!)

Returns the String value for the key.

open MediaMetadataEditor!
putBitmap(key: Int, bitmap: Bitmap!)

Adds image.

open MediaMetadataEditor!
putLong(key: Int, value: Long)

Adds numerical information.

open MediaMetadataEditor!
putObject(key: Int, value: Any!)

Adds information stored as an instance.

open MediaMetadataEditor!
putString(key: Int, value: String!)

Adds textual information.

open Unit

Causes all metadata fields to be read-only.

Constants

BITMAP_KEY_ARTWORK

Added in API level 19
static val BITMAP_KEY_ARTWORK: Int

Deprecated: Deprecated in Java.

The metadata key for the content artwork / album art.

Value: 100

RATING_KEY_BY_OTHERS

Added in API level 19
static val RATING_KEY_BY_OTHERS: Int

Deprecated: Deprecated in Java.

The metadata key for the content's average rating, not the user's rating. The value associated with this key is a Rating instance.

Value: 101

RATING_KEY_BY_USER

Added in API level 19
static val RATING_KEY_BY_USER: Int

Deprecated: Deprecated in Java.

The metadata key for the content's user rating. The value associated with this key is a Rating instance. This key can be flagged as "editable" (with addEditableKey(int)) to enable receiving user rating values through the android.media.RemoteControlClient.OnMetadataUpdateListener interface.

Value: 268435457

Public methods

addEditableKey

Added in API level 19
open fun addEditableKey(key: Int): Unit

Deprecated: Deprecated in Java.

Flags the given key as being editable. This should only be used by metadata publishers, such as RemoteControlClient, which will declare the metadata field as eligible to be updated, with new values received through the RemoteControlClient.OnMetadataUpdateListener interface.

Parameters
key Int: the type of metadata that can be edited. The supported key is RATING_KEY_BY_USER.

apply

Added in API level 19
abstract fun apply(): Unit

Deprecated: Deprecated in Java.

Applies all of the metadata changes that have been set since the MediaMetadataEditor instance was created or since clear() was called. Subclasses should synchronize on this for thread safety.

clear

Added in API level 19
open fun clear(): Unit

Deprecated: Deprecated in Java.

Clears all the pending metadata changes set since the MediaMetadataEditor instance was created or since this method was last called. Note that clearing the metadata doesn't reset the editable keys (use removeEditableKeys() instead).

getBitmap

Added in API level 19
open fun getBitmap(
    key: Int,
    defaultValue: Bitmap!
): Bitmap!

Deprecated: Deprecated in Java.

Returns the Bitmap value for the key.

Parameters
key Int: the BITMAP_KEY_ARTWORK key
defaultValue Bitmap!: the value returned if the key is not present
Return
Bitmap! the Bitmap value for the key, or the supplied default value if the key is not present
Exceptions
java.lang.IllegalArgumentException

getEditableKeys

Added in API level 19
open fun getEditableKeys(): IntArray!

Deprecated: Deprecated in Java.

Retrieves the keys flagged as editable.

Return
IntArray! null if there are no editable keys, or an array containing the keys.

getLong

Added in API level 19
open fun getLong(
    key: Int,
    defaultValue: Long
): Long

Deprecated: Deprecated in Java.

Returns the long value for the key.

Parameters
key Int: one of the keys supported in putLong(int,long)
defaultValue Long: the value returned if the key is not present
Return
Long the long value for the key, or the supplied default value if the key is not present
Exceptions
java.lang.IllegalArgumentException

getObject

Added in API level 19
open fun getObject(
    key: Int,
    defaultValue: Any!
): Any!

Deprecated: Deprecated in Java.

Returns an object representation of the value for the key

Parameters
key Int: one of the keys supported in putObject(int,java.lang.Object)
defaultValue Any!: the value returned if the key is not present
Return
Any! the object for the key, as a Long, Bitmap, String, or Rating depending on the key value, or the supplied default value if the key is not present
Exceptions
java.lang.IllegalArgumentException

getString

Added in API level 19
open fun getString(
    key: Int,
    defaultValue: String!
): String!

Deprecated: Deprecated in Java.

Returns the String value for the key.

Parameters
key Int: one of the keys supported in putString(int,java.lang.String)
defaultValue String!: the value returned if the key is not present
Return
String! the String value for the key, or the supplied default value if the key is not present
Exceptions
java.lang.IllegalArgumentException

putBitmap

Added in API level 19
open fun putBitmap(
    key: Int,
    bitmap: Bitmap!
): MediaMetadataEditor!

Deprecated: Deprecated in Java.

Adds image.

Parameters
key Int: the identifier of the bitmap to set. The only valid value is BITMAP_KEY_ARTWORK
bitmap Bitmap!: The bitmap for the artwork, or null if there isn't any.
Return
MediaMetadataEditor! Returns a reference to the same MediaMetadataEditor object, so you can chain put calls together.
Exceptions
java.lang.IllegalArgumentException

putLong

Added in API level 19
open fun putLong(
    key: Int,
    value: Long
): MediaMetadataEditor!

Deprecated: Deprecated in Java.

Adds numerical information. Note that none of the information added after apply() has been called will be available to consumers of metadata stored by the MediaMetadataEditor.

Parameters
key Int: the identifier of a the metadata field to set. Valid values are android.media.MediaMetadataRetriever#METADATA_KEY_CD_TRACK_NUMBER, android.media.MediaMetadataRetriever#METADATA_KEY_DISC_NUMBER, android.media.MediaMetadataRetriever#METADATA_KEY_DURATION (with a value expressed in milliseconds), android.media.MediaMetadataRetriever#METADATA_KEY_YEAR.
value Long: The long value for the given key
Return
MediaMetadataEditor! Returns a reference to the same MediaMetadataEditor object, so you can chain put calls together.
Exceptions
java.lang.IllegalArgumentException

putObject

Added in API level 19
open fun putObject(
    key: Int,
    value: Any!
): MediaMetadataEditor!

Deprecated: Deprecated in Java.

Adds information stored as an instance. Note that none of the information added after apply() has been called will be available to consumers of metadata stored by the MediaMetadataEditor.

Parameters
key Int: the identifier of a the metadata field to set. Valid keys for a:
value Any!: the metadata to add.
Return
MediaMetadataEditor! Returns a reference to the same MediaMetadataEditor object, so you can chain put calls together.
Exceptions
java.lang.IllegalArgumentException

putString

Added in API level 19
open fun putString(
    key: Int,
    value: String!
): MediaMetadataEditor!

Deprecated: Deprecated in Java.

Adds textual information. Note that none of the information added after apply() has been called, will be available to consumers of metadata stored by the MediaMetadataEditor.

Parameters
key Int: The identifier of a the metadata field to set. Valid values are android.media.MediaMetadataRetriever#METADATA_KEY_ALBUM, android.media.MediaMetadataRetriever#METADATA_KEY_ALBUMARTIST, android.media.MediaMetadataRetriever#METADATA_KEY_TITLE, android.media.MediaMetadataRetriever#METADATA_KEY_ARTIST, android.media.MediaMetadataRetriever#METADATA_KEY_AUTHOR, android.media.MediaMetadataRetriever#METADATA_KEY_COMPILATION, android.media.MediaMetadataRetriever#METADATA_KEY_COMPOSER, android.media.MediaMetadataRetriever#METADATA_KEY_DATE, android.media.MediaMetadataRetriever#METADATA_KEY_GENRE, android.media.MediaMetadataRetriever#METADATA_KEY_WRITER.
value String!: The text for the given key, or null to signify there is no valid information for the field.
Return
MediaMetadataEditor! Returns a reference to the same MediaMetadataEditor object, so you can chain put calls together.

removeEditableKeys

Added in API level 19
open fun removeEditableKeys(): Unit

Deprecated: Deprecated in Java.

Causes all metadata fields to be read-only.