# NotificationCompat.DecoratedCustomViewStyle

Artifact: [androidx.core:core](https://developer.android.com/jetpack/androidx/releases/core) [View Source](https://cs.android.com/search?q=file:androidx/core/app/NotificationCompat.java+class:androidx.core.app.NotificationCompat.DecoratedCustomViewStyle) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

*** ** * ** ***


```
public class NotificationCompat.DecoratedCustomViewStyle extends NotificationCompat.Style
```

<br />

|---|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object.html) |||
| ↳ | [androidx.core.app.NotificationCompat.Style](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Style) ||
|   | ↳ | [androidx.core.app.NotificationCompat.DecoratedCustomViewStyle](https://developer.android.com/reference/androidx/core/app/NotificationCompat.DecoratedCustomViewStyle) |

*** ** * ** ***

Notification style for custom views that are decorated by the system.

Instead of providing a 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.

Use `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomContentView(android.widget.RemoteViews)`, `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomBigContentView(android.widget.RemoteViews)` and `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews)` to set the corresponding custom views to display.

To use this style with your Notification, feed it to `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setStyle(androidx.core.app.NotificationCompat.Style)` like so:

```
Notification noti = new NotificationCompat.Builder()
    .setSmallIcon(R.drawable.ic_stat_player)
    .setLargeIcon(albumArtBitmap))
    .setCustomContentView(contentView)
    .setStyle(new NotificationCompat.DecoratedCustomViewStyle())
    .build();
```

If you are using this style, consider using the corresponding styles like or in your custom views in order to get the correct styling on each platform version.

## Summary

| ### Public constructors |
|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.DecoratedCustomViewStyle#DecoratedCustomViewStyle()()` |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/CharSequence.html>` | `@https://developer.android.com/reference/androidx/annotation/RequiresApi(value = 24) https://developer.android.com/reference/androidx/core/app/NotificationCompat.DecoratedCustomViewStyle#getTextsFromContentView(android.content.Context,android.app.Notification)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification )` A helper method to get texts from a `https://developer.android.com/reference/android/app/Notification.html`'s custom content view made by either `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomBigContentView(android.widget.RemoteViews)`, `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomContentView(android.widget.RemoteViews)` or `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews)`. |

### Inherited methods

From [androidx.core.app.NotificationCompat.Style](https://developer.android.com/reference/androidx/core/app/NotificationCompat.Style) `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/android/app/Notification.html` `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Style#build()()`

If this Style object has been set on a notification builder, this method will build that notification and return it.
`void` `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Style#setBuilder(androidx.core.app.NotificationCompat.Builder)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder builder)`

Link this rich notification style with a notification builder.

## Public constructors

### DecoratedCustomViewStyle

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/core#1.1.0)

```
public DecoratedCustomViewStyle()
```

## Public methods

### getTextsFromContentView

Added in [1.15.0](https://developer.android.com/jetpack/androidx/releases/core#1.15.0)

```
@RequiresApi(value = 24)
public static @NonNull List<CharSequence> getTextsFromContentView(
    @NonNull Context context,
    @NonNull Notification notification
)
```

A helper method to get texts from a `https://developer.android.com/reference/android/app/Notification.html`'s custom content view made by either `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomBigContentView(android.widget.RemoteViews)`, `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomContentView(android.widget.RemoteViews)` or `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setCustomHeadsUpContentView(android.widget.RemoteViews)`. Note that this method will not look for `https://developer.android.com/reference/android/app/Notification.html#publicVersion` made by `https://developer.android.com/reference/androidx/core/app/NotificationCompat.Builder#setPublicVersion(android.app.Notification)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | A `https://developer.android.com/reference/android/content/Context.html` that will be used to inflate the content view from the notification. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/app/Notification.html notification` | The notification from which to get texts from its content view. |

| Returns |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/java/lang/CharSequence.html>` | A list of text from the notification custom content view made by the above method. Note that the method only returns a list of text from one of the custom view as the above when it set, meaning when multiple custom content views has set in a notification, the returned list will base on the detail of custom content and usage as the priority: First is `https://developer.android.com/reference/android/app/Notification.html#bigContentView`, then is `https://developer.android.com/reference/android/app/Notification.html#contentView` when no big content view has set, or `https://developer.android.com/reference/android/app/Notification.html#headsUpContentView` when set. Otherwise, returns the empty list. |