# TimelineBuilders.Timeline

Artifact: [androidx.wear.protolayout:protolayout](https://developer.android.com/jetpack/androidx/releases/wear-protolayout) [View Source](https://cs.android.com/search?q=file:androidx/wear/protolayout/TimelineBuilders.java+class:androidx.wear.protolayout.TimelineBuilders.Timeline) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

*** ** * ** ***


```
@RequiresSchemaVersion(major = 1, minor = 0)
public final class TimelineBuilders.Timeline
```

<br />

*** ** * ** ***

A collection of `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.TimelineEntry` items.

`https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.TimelineEntry` items can be used to update a layout on-screen at known times, without having to explicitly update a layout. This allows for cases where, say, a calendar can be used to show the next event, and automatically switch to showing the next event when one has passed.

The active `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.TimelineEntry` is switched, at most, once a minute. In the case where the validity periods of `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.TimelineEntry` items overlap, the item with the shortest\* validity period will be shown. This allows a layout provider to show a "default" layout, and override it at set points without having to explicitly insert the default layout between the "override" layout.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline.Builder` Builder for `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline` |

| ### Public methods |
|---|---|
| `static @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline` | `@https://developer.android.com/reference/androidx/wear/protolayout/expression/RequiresSchemaVersion(major = 1, minor = 0) https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline#fromLayoutElement(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement)( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement layoutElement )` Returns the `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline` object containing the given layout element. |
| `@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/wear/protolayout/TimelineBuilders.TimelineEntry>` | `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline#getTimelineEntries()()` Gets the entries in a timeline. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html` | `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline#toString()()` |

## Public methods

### fromLayoutElement

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
@RequiresSchemaVersion(major = 1, minor = 0)
public static @NonNull TimelineBuilders.Timeline fromLayoutElement(
    @NonNull LayoutElementBuilders.LayoutElement layoutElement
)
```

Returns the `https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline` object containing the given layout element.

### getTimelineEntries

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-protolayout#1.0.0)

```
public @NonNull List<TimelineBuilders.TimelineEntry> getTimelineEntries()
```

Gets the entries in a timeline.

### toString

```
public @NonNull String toString()
```