# NotificationCompat.ProgressStyle

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.ProgressStyle) Added in [1.17.0](https://developer.android.com/jetpack/androidx/releases/core#1.17.0)

*** ** * ** ***


```
public class NotificationCompat.ProgressStyle 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.ProgressStyle](https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle) |

*** ** * ** ***

Helper class for generating large-format notifications that display progress to the user with a highly customizable progress bar with segments, points, a custom tracker icon, and custom icons at the start and end of the progress bar. If the platform does not provide large-format notifications, this method has no effect. The user will always see the normal notification view. This class is a "rebuilder": It attaches to a Builder object and modifies its behavior, like so:

```
new NotificationCompat.Builder(context)
  .setSmallIcon(R.drawable.ic_notification)
  .setColor(Color.GREEN)
  .setColorized(true)
  .setContentTitle("Arrive 10:08 AM").
  .setContentText("Dominique Ansel Bakery Soho")
  .addAction(new NotificationCompat.Action("Exit navigation",...))
  .setStyle(new NotificationCompat.ProgressStyle()
      .setStyledByProgress(false)
      .setProgress(456)
      .setProgressTrackerIcon(IconCompat.createWithResource(R.drawable.ic_driving_tracker))
      .addProgressSegment(new Segment(41).setColor(Color.BLACK))
      .addProgressSegment(new Segment(552).setColor(Color.YELLOW))
      .addProgressSegment(new Segment(253).setColor(Color.YELLOW))
      .addProgressSegment(new Segment(94).setColor(Color.BLUE))
      .addProgressPoint(new Point(60).setColor(Color.RED))
      .addProgressPoint(new Point(560).setColor(Color.YELLOW))
  )
```

NOTE: ProgressStyle Notifications are supported on Android 36 and above. If the SDK version is below 36, the ProgressStyle will fall back to the default notification style.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point` A point within the progress bar, defining its position and color. |
| `public final class https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment` A segment of the progress bar, which defines its length and color. |

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

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#addProgressPoint(androidx.core.app.NotificationCompat.ProgressStyle.Point)(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point point)` Adds another point. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#addProgressSegment(androidx.core.app.NotificationCompat.ProgressStyle.Segment)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment segment )` Appends a segment to the end of the progress bar. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgress()()` Gets the progress value of the progress bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressEndIcon()()` Gets the progress bar end icon. |
| `@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressMax()()` Gets the sum of the lengths of all Segments in the style, which defines the maximum progress. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point>` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressPoints()()` Gets the points that are displayed on the progress bar. . |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment>` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressSegments()()` Gets the segments that define the background layer of the progress bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressStartIcon()()` Gets the progress bar start icon. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#getProgressTrackerIcon()()` Gets the progress tracker icon for the progress bar. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#isProgressIndeterminate()()` Get indeterminate value of the progress bar. |
| `boolean` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#isStyledByProgress()()` Gets whether the progress bar's style is based on its progress. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgress(int)(@https://developer.android.com/reference/androidx/annotation/IntRange(from = 0) int progress)` Specifies the progress (in the same units as `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment#getLength()`) of the tracker along the length of the bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressEndIcon(androidx.core.graphics.drawable.IconCompat)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat endIcon)` An optional square icon that appears at the end of the progress bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressIndeterminate(boolean)(boolean indeterminate)` Used to indicate an initialization state without a known progress amount. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressPoints(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Point>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point> points )` Replaces all the progress points. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressSegments(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Segment>)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/util/List.html<https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment> progressSegments )` Sets or replaces the segments of the progress bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressStartIcon(androidx.core.graphics.drawable.IconCompat)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat startIcon)` An optional square icon that appears at the start of the progress bar. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressTrackerIcon(androidx.core.graphics.drawable.IconCompat)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/core/graphics/drawable/IconCompat trackerIcon)` An optional icon that can appear as an overlay on the bar at the point of current progress. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle` | `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setStyledByProgress(boolean)(boolean enabled)` Indicates whether the segments and points will be styled differently based on whether they are behind or ahead of the current progress. |

### 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

### ProgressStyle

Added in 1.17.0

```
public ProgressStyle()
```

## Public methods

### addProgressPoint

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

```
public @NonNull NotificationCompat.ProgressStyle addProgressPoint(@NonNull NotificationCompat.ProgressStyle.Point point)
```

Adds another point. Points within a progress bar are used to visualize distinct stages or milestones. For example, you might use points to mark stops in a multi-stop navigation journey, where each point represents a destination. Points can be added in any order, as their position within the progress bar is determined by their individual `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point#getPosition()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point` |   |

### addProgressSegment

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

```
public @NonNull NotificationCompat.ProgressStyle addProgressSegment(
    @NonNull NotificationCompat.ProgressStyle.Segment segment
)
```

Appends a segment to the end of the progress bar. Segments allow for creating progress bars with multiple colors or sections to represent different stages or categories of progress. For example, Traffic conditions along a navigation journey.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment` |   |

### getProgress

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

```
public @IntRange(from = 0) int getProgress()
```

Gets the progress value of the progress bar.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgress(int)` |   |

### getProgressEndIcon

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

```
public @Nullable IconCompat getProgressEndIcon()
```

Gets the progress bar end icon.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressEndIcon(androidx.core.graphics.drawable.IconCompat)` |   |

### getProgressMax

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

```
public @IntRange(from = 0) int getProgressMax()
```

Gets the sum of the lengths of all Segments in the style, which defines the maximum progress. Defaults to 100 when segments are omitted.

### getProgressPoints

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

```
public @NonNull List<NotificationCompat.ProgressStyle.Point> getProgressPoints()
```

Gets the points that are displayed on the progress bar. .

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressPoints(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Point>)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#addProgressPoint(androidx.core.app.NotificationCompat.ProgressStyle.Point)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point` |   |

### getProgressSegments

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

```
public @NonNull List<NotificationCompat.ProgressStyle.Segment> getProgressSegments()
```

Gets the segments that define the background layer of the progress bar. If no segments are provided, the progress bar will be rendered with a single segment with length 100 and default color.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressSegments(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Segment>)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#addProgressSegment(androidx.core.app.NotificationCompat.ProgressStyle.Segment)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment` |   |

### getProgressStartIcon

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

```
public @Nullable IconCompat getProgressStartIcon()
```

Gets the progress bar start icon.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressStartIcon(androidx.core.graphics.drawable.IconCompat)` |   |

### getProgressTrackerIcon

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

```
public @Nullable IconCompat getProgressTrackerIcon()
```

Gets the progress tracker icon for the progress bar.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressTrackerIcon(androidx.core.graphics.drawable.IconCompat)` |   |

### isProgressIndeterminate

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

```
public boolean isProgressIndeterminate()
```

Get indeterminate value of the progress bar.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressIndeterminate(boolean)` |   |

### isStyledByProgress

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

```
public boolean isStyledByProgress()
```

Gets whether the progress bar's style is based on its progress.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setStyledByProgress(boolean)` |   |

### setProgress

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

```
public @NonNull NotificationCompat.ProgressStyle setProgress(@IntRange(from = 0) int progress)
```

Specifies the progress (in the same units as `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment#getLength()`) of the tracker along the length of the bar. The max progress value is the sum of all Segment lengths. The default value is 0.

### setProgressEndIcon

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressEndIcon(@Nullable IconCompat endIcon)
```

An optional square icon that appears at the end of the progress bar. This icon will be cropped to its central square. This icon will NOT be mirrored in RTL layouts.

### setProgressIndeterminate

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressIndeterminate(boolean indeterminate)
```

Used to indicate an initialization state without a known progress amount. When specified, the following fields are ignored:

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgress(int)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressSegments(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Segment>)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressPoints(java.util.List<androidx.core.app.NotificationCompat.ProgressStyle.Point>)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setProgressTrackerIcon(androidx.core.graphics.drawable.IconCompat)` |   |
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle#setStyledByProgress(boolean)` | If the app provides exactly one Segment, that segment's color will be used to style the indeterminate bar. |

### setProgressPoints

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressPoints(
    @NonNull List<NotificationCompat.ProgressStyle.Point> points
)
```

Replaces all the progress points. Points within a progress bar are used to visualize distinct stages or milestones. For example, you might use points to mark stops in a multi-stop navigation journey, where each point represents a destination.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Point` |   |

### setProgressSegments

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressSegments(
    @NonNull List<NotificationCompat.ProgressStyle.Segment> progressSegments
)
```

Sets or replaces the segments of the progress bar. Segments allow for creating progress bars with multiple colors or sections to represent different stages or categories of progress. For example, Traffic conditions along a navigation journey.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/core/app/NotificationCompat.ProgressStyle.Segment` |   |

### setProgressStartIcon

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressStartIcon(@Nullable IconCompat startIcon)
```

An optional square icon that appears at the start of the progress bar. This icon will be cropped to its central square. This icon will NOT be mirrored in RTL layouts.

### setProgressTrackerIcon

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

```
public @NonNull NotificationCompat.ProgressStyle setProgressTrackerIcon(@Nullable IconCompat trackerIcon)
```

An optional icon that can appear as an overlay on the bar at the point of current progress. Aspect ratio may be anywhere from 2:1 to 1:2; content outside that aspect ratio range will be cropped. This icon will be mirrored in RTL.

### setStyledByProgress

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

```
public @NonNull NotificationCompat.ProgressStyle setStyledByProgress(boolean enabled)
```

Indicates whether the segments and points will be styled differently based on whether they are behind or ahead of the current progress. When true, segments appearing ahead of the current progress will be given a slightly different appearance to indicate that it is part of the progress bar that is not "filled". When false, all segments will be given the filled appearance, and it will be the app's responsibility to use #setProgressTrackerIcon or segment colors to make the current progress clear to the user. the default value is true.