# Button.Builder

Artifact: [androidx.wear.tiles:tiles-material](https://developer.android.com/jetpack/androidx/releases/wear-tiles) [View Source](https://cs.android.com/search?q=file:androidx/wear/tiles/material/Button.java+class:androidx.wear.tiles.material.Button.Builder) Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

*** ** * ** ***


```
public final class Button.Builder implements LayoutElementBuilders.LayoutElement.Builder
```

<br />

*** ** * ** ***

> [!CAUTION]
> **This class is deprecated.**   
> Deprecated in Java

Builder class for `https://developer.android.com/reference/androidx/wear/tiles/material/Button`.

## Summary

| ### Public constructors |
|---|
| `[Builder](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable))( @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/androidx/wear/tiles/ModifiersBuilders.Clickable clickable )` **This method is deprecated.** Deprecated in Java |

| ### Public methods |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button` | `[build](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#build())()` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setButtonColors](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setButtonColors(androidx.wear.tiles.material.ButtonColors))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/ButtonColors buttonColors)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setContentDescription](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setContentDescription(java.lang.CharSequence))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/CharSequence.html contentDescription)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setCustomContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders.LayoutElement content)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html imageResourceId)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp))( @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html imageResourceId, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DimensionBuilders.DpProp size )` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setImageContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html imageResourceId)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setSize](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setSize(androidx.wear.tiles.DimensionBuilders.DpProp))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DimensionBuilders.DpProp size)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setSize](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setSize(float))(@https://developer.android.com/reference/androidx/annotation/Dimension(unit = 0) float size)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text)` **This method is deprecated.** Deprecated in Java |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder` | `[setTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String,int))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html text, int typographyName)` **This method is deprecated.** Deprecated in Java |

## Public constructors

### Builder

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public [Builder](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable))(
    @NonNull Context context,
    @NonNull ModifiersBuilders.Clickable clickable
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Creates a builder for the `https://developer.android.com/reference/androidx/wear/tiles/material/Button` from the given content. Custom content should be later set with one of the following (`https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp)`, `https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String)`, `https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String)`.

| Parameters |
|---|---|
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/android/content/Context.html context` | The application's context. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/ModifiersBuilders.Clickable clickable` | Associated `https://developer.android.com/reference/androidx/wear/tiles/ModifiersBuilders.Clickable` for click events. When the Button is clicked it will fire the associated action. |

## Public methods

### build

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button [build](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#build())()
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Constructs and returns `https://developer.android.com/reference/androidx/wear/tiles/material/Button` with the provided field and look.

### setButtonColors

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setButtonColors](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setButtonColors(androidx.wear.tiles.material.ButtonColors))(@NonNull ButtonColors buttonColors)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the colors for the `https://developer.android.com/reference/androidx/wear/tiles/material/Button`. If not set, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#PRIMARY_COLORS()` will be used.

### setContentDescription

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setContentDescription](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setContentDescription(java.lang.CharSequence))(@NonNull CharSequence contentDescription)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content description for the `https://developer.android.com/reference/androidx/wear/tiles/material/Button`. It is highly recommended to provide this for button containing icon or image.

### setCustomContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setCustomContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@NonNull LayoutElementBuilders.LayoutElement content)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the custom content for this Button. Any previously added content will be overridden.

### setIconContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String))(@NonNull String imageResourceId)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given icon with the default size that is half of the set size of the button. Any previously added content will be overridden. Provided icon will be tinted to the given content color from `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonColors`. This icon should be image with chosen alpha channel and not an actual image.

### setIconContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setIconContent(java.lang.String,androidx.wear.tiles.DimensionBuilders.DpProp))(
    @NonNull String imageResourceId,
    @NonNull DimensionBuilders.DpProp size
)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given icon with the given size. Any previously added content will be overridden. Provided icon will be tinted to the given content color from `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonColors` and with the given size. This icon should be image with chosen alpha channel and not an actual image.

### setImageContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setImageContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setImageContent(java.lang.String))(@NonNull String imageResourceId)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given image, i.e. contacts photo. Any previously added content will be overridden.

### setSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setSize](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setSize(androidx.wear.tiles.DimensionBuilders.DpProp))(@NonNull DimensionBuilders.DpProp size)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the size for the `https://developer.android.com/reference/androidx/wear/tiles/material/Button`. Strongly recommended values are `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()`. If not set, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()` will be used.

### setSize

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setSize](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setSize(float))(@Dimension(unit = 0) float size)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the size for the `https://developer.android.com/reference/androidx/wear/tiles/material/Button`. Strongly recommended values are `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()`. If not set, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()` will be used.

### setTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String))(@NonNull String text)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given text with the default font for the set size (for the `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#DEFAULT_SIZE()`, `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#LARGE_SIZE()` and `https://developer.android.com/reference/androidx/wear/tiles/material/ButtonDefaults#EXTRA_LARGE_SIZE()` is `https://developer.android.com/reference/androidx/wear/tiles/material/Typography#TYPOGRAPHY_TITLE2()`, `https://developer.android.com/reference/androidx/wear/tiles/material/Typography#TYPOGRAPHY_TITLE1()` and `https://developer.android.com/reference/androidx/wear/tiles/material/Typography#TYPOGRAPHY_DISPLAY3()` respectively). Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.

### setTextContent

Added in [1.1.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.1.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-tiles#1.2.0)

```
public @NonNull Button.Builder [setTextContent](https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setTextContent(java.lang.String,int))(@NonNull String text, int typographyName)
```

> [!CAUTION]
> **This method is deprecated.**   
> Deprecated in Java

Sets the content of this Button to be the given text with the given font. If you need more font related customization, consider using `https://developer.android.com/reference/androidx/wear/tiles/material/Button.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement)` with `https://developer.android.com/reference/androidx/wear/tiles/material/Text` component. Any previously added content will be overridden. Text should contain no more than 3 characters, otherwise it will overflow from the edges.