# TimelineBuilders.Timeline

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

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/protolayout/TimelineBuilders.Timeline "View this page in Java")

<br />

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

<br />

*** ** * ** ***

A collection of[TimelineEntry](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.TimelineEntry)items.

[TimelineEntry](https://developer.android.com/reference/kotlin/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[TimelineEntry](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.TimelineEntry)is switched, at most, once a minute. In the case where the validity periods of[TimelineEntry](https://developer.android.com/reference/kotlin/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                                                                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `class `[TimelineBuilders.Timeline.Builder](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline.Builder) Builder for[Timeline](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline) |

|                                                                                                                                                                ### Public functions                                                                                                                                                                 |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `java-static `[TimelineBuilders.Timeline](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline)                                                                                                                                                                                                       | `@`[RequiresSchemaVersion](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/expression/RequiresSchemaVersion)`(major = 1, minor = 0)` [fromLayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline#fromLayoutElement(androidx.wear.protolayout.LayoutElementBuilders.LayoutElement))`(layoutElement: `[LayoutElementBuilders.LayoutElement](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/LayoutElementBuilders.LayoutElement)`)` Returns the[Timeline](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline)object containing the given layout element. |
| `(`[Mutable](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-mutable-list/index.html)`)`[List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)`<`[TimelineBuilders.TimelineEntry](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.TimelineEntry)`!>` | [getTimelineEntries](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline#getTimelineEntries())`()` Gets the entries in a timeline.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)                                                                                                                                                                                                                                                                   | [toString](https://developer.android.com/reference/kotlin/androidx/wear/protolayout/TimelineBuilders.Timeline#toString())`()`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |

## Public functions

### fromLayoutElement

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

```
@RequiresSchemaVersion(major = 1, minor = 0)
java-static fun fromLayoutElement(layoutElement: LayoutElementBuilders.LayoutElement): TimelineBuilders.Timeline
```

Returns the[Timeline](https://developer.android.com/reference/kotlin/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)  

```
fun getTimelineEntries(): (Mutable)List<TimelineBuilders.TimelineEntry!>
```

Gets the entries in a timeline.  

### toString

```
fun toString(): String
```