Help Center

Local Navigation

Object: MediaList

Availability

BlackBerry® Device Software version 4.6 or later

The MediaList object represents an ordered collection of media. An empty list is equivalent to a list that contains a value of all.

MediaList properties

Property name

Type

Description

Status

Availability

length

int

Returns the number of media in the list.

read only

4.6 or later

mediaText

String

Specifies a comma-separated list of media.

When setting a value for this property, the following errors may be thrown:

  • SYNTAX_ERR: Thrown if the string value is unparsable.

  • NO_MODIFICATION_ERR: Thrown if the MediaList object is read only.

writable

4.6 or later

MediaList methods

Method name

Description

Availability

appendMedium()

Adds the given medium to the end of the MediaList object.

4.6 or later

deleteMedium()

Removes the given medium from the MediaList object.

4.6 or later

item()

Returns the medium at the given index in the collection.

4.6 or later

Method: MediaList.appendMedium()

Availability

BlackBerry® Device Software version 4.6 or later

The appendMedium() method adds the given medium to the end of the MediaList object.

Syntax

MediaList.appendMedium( newMedium )

Parameters

Parameter

Type

Description

newMedium

String

The medium to append to the end of MediaList. If newMedium already exists in the list, it is first removed and then replaced.

Return values

None.

Exceptions

Exception

Description

NO_MODIFICATION_ALLOWED_ERR

This error is thrown if the MediaList object is read only.

INVALID_CHARACTER_ERR

This error is thrown if newMedium contains characters that are invalid in the style language.

Method: MediaList.deleteMedium()

Availability

BlackBerry® Device Software version 4.6 or later

The deleteMedium() method removes the given medium from the MediaList object.

Syntax

MediaList.deleteMedium( oldMedium )

Parameters

Parameter

Type

Description

oldMedium

String

The medium to remove from MediaList.

Return values

None.

Exceptions

Exception

Description

NO_MODIFICATION_ALLOWED_ERR

This error is thrown if the MediaList object is read only.

NOT_FOUND_ERR

This error is thrown if no medium matching oldMedium exists in the collection.

Method: MediaList.item()

Availability

BlackBerry® Device Software version 4.6 or later

The item() method returns the medium at the given index in the collection.

Syntax

MediaList.item( index )

Parameters

Parameter

Type

Description

index

int

An integer that represents the item’s position in MediaList object. Valid values are between 0 and MediaList.length-1 inclusive.

Return values

Returns the medium at the indexth position in MediaList, or null if an invalid index position is specified.

Exceptions

None.

Next topic: Object: MimeType

Was this information helpful? Send us your comments.