# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Inherited Fields | Ctors | Methods | Inherited Methods

# Notification.MediaStyle

`public static class Notification.MediaStyle`
`` `extends Notification.Style` ``

java.lang.Object
↳ | android.app.Notification.Style
| ↳ | android.app.Notification.MediaStyle

Known direct subclasses Notification.DecoratedMediaCustomViewStyle
Notification.DecoratedMediaCustomViewStyle | Notification style for media custom views that are decorated by the system Instead of providing a media notification that is completely custom, a developer can set this style and still obtain system decorations like the notification header with the expand affordance and actions.

Notification style for media playback notifications. In the expanded form, `Notification#bigContentView`, up to 5 `Notification.Action`s specified with `addAction` will be shown as icon-only pushbuttons, suitable for transport controls. The Bitmap given to `setLargeIcon()` will be treated as album artwork.

Unlike the other styles provided here, MediaStyle can also modify the standard-size `Notification#contentView`; by providing action indices to `setShowActionsInCompactView(int)` you can promote up to 3 actions to be displayed in the standard view alongside the usual content.

Notifications created with MediaStyle will have their category set to `CATEGORY_TRANSPORT` unless you set a different category using `setCategory()`.

Finally, if you attach a `MediaSession.Token` using `setMediaSession(MediaSession.Token)`, the System UI can identify this as a notification representing an active media session and respond accordingly (by showing album artwork in the lockscreen, for example).

Starting at `Android O` any notification that has a media session attached with `setMediaSession(android.media.session.MediaSession.Token)` will be colorized. You can opt-out of this behavior by using `Notification.Builder#setColorized(boolean)`.

To use this style with your Notification, feed it to `Notification.Builder#setStyle(android.app.Notification.Style)` like so:

     Notification noti = new Notification.Builder()
         .setSmallIcon(R.drawable.ic_stat_player)
         .setContentTitle("Track title")
         .setContentText("Artist - Album")
         .setLargeIcon(albumArtBitmap))
         .setStyle(new Notification.MediaStyle()
             .setMediaSession(mySession))
         .build();

See also:

- `Notification.bigContentView`
- `Notification.Builder.setColorized(boolean)`

## Summary

### Inherited fields
From class `android.app.Notification.Style`
`protected Notification.Builder` | `mBuilder`

### Public constructors
`MediaStyle()`
`MediaStyle(Notification.Builder builder)` This constructor is deprecated. use `MediaStyle()`.

### Public methods
`Notification.MediaStyle` | `setMediaSession(MediaSession.Token token)` Attach a `MediaSession.Token` to this Notification to provide additional playback information and control to the SystemUI.
`Notification.MediaStyle` | `setShowActionsInCompactView(int... actions)` Request up to 3 actions (by index in the order of addition) to be shown in the compact notification view.

### Inherited methods
From class `android.app.Notification.Style`
`Notification` | `build()` Calls `Notification.Builder.build()` on the Builder this Style is attached to.
`void` | `checkBuilder()`
`RemoteViews` | `getStandardView(int layoutId)`
`void` | `internalSetBigContentTitle(CharSequence title)` Overrides ContentTitle in the big form of the template.
`void` | `internalSetSummaryText(CharSequence cs)` Set the first line of text after the detail section in the big form of the template.
`void` | `setBuilder(Notification.Builder builder)`
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

### MediaStyle

    public MediaStyle ()

### MediaStyle

    public MediaStyle (Notification.Builder builder)

This constructor is deprecated.
use `MediaStyle()`.

Parameters
`builder` | `Notification.Builder`

## Public methods

### setMediaSession

    public Notification.MediaStyle setMediaSession (MediaSession.Token token)

Attach a `MediaSession.Token` to this Notification to provide additional playback information and control to the SystemUI.

Parameters
`token` | `MediaSession.Token`

Returns
`Notification.MediaStyle` |

### setShowActionsInCompactView

    public Notification.MediaStyle setShowActionsInCompactView (int... actions)

Request up to 3 actions (by index in the order of addition) to be shown in the compact notification view.

Parameters
`actions` | `int`: the indices of the actions to show in the compact notification view

Returns
`Notification.MediaStyle` |

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