# Chip.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/Chip.java+class:androidx.wear.tiles.material.Chip.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 Chip.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/Chip`.

## Summary

| ### Public constructors |
|---|
| `[Builder](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable,androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters))( @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, @https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DeviceParametersBuilders.DeviceParameters deviceParameters )` **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/Chip` | `[build](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.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/Chip.Builder` | `[setChipColors](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setChipColors(androidx.wear.tiles.material.ChipColors))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors chipColors)` **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/Chip.Builder` | `[setContentDescription](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.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/Chip.Builder` | `[setCustomContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.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/Chip.Builder` | `[setHorizontalAlignment](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setHorizontalAlignment(int))(int horizontalAlignment)` **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/Chip.Builder` | `[setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.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/Chip.Builder` | `[setPrimaryLabelContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setPrimaryLabelContent(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html primaryLabel)` **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/Chip.Builder` | `[setSecondaryLabelContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setSecondaryLabelContent(java.lang.String))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/java/lang/String.html secondaryLabel)` **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/Chip.Builder` | `[setWidth](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setWidth(androidx.wear.tiles.DimensionBuilders.ContainerDimension))(@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DimensionBuilders.ContainerDimension width)` **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/Chip.Builder` | `[setWidth](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setWidth(float))(@https://developer.android.com/reference/androidx/annotation/Dimension(unit = 0) float width)` **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/Chip.Builder#Builder(android.content.Context,androidx.wear.tiles.ModifiersBuilders.Clickable,androidx.wear.tiles.DeviceParametersBuilders.DeviceParameters))(
    @NonNull Context context,
    @NonNull ModifiersBuilders.Clickable clickable,
    @NonNull DeviceParametersBuilders.DeviceParameters deviceParameters
)
```

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

Creates a builder for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip` with associated action. It is required to add content later with setters.

| 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 Clickable for click events. When the Chip is clicked it will fire the associated action. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/NonNull.html https://developer.android.com/reference/androidx/wear/tiles/DeviceParametersBuilders.DeviceParameters deviceParameters` | The device parameters used to derive defaults for this Chip. |

## 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 Chip [build](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#build())()
```

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

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

### setChipColors

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 Chip.Builder [setChipColors](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setChipColors(androidx.wear.tiles.material.ChipColors))(@NonNull ChipColors chipColors)
```

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

Sets the colors for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. If set, `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors#getBackgroundColor()` will be used for the background of the button, `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors#getContentColor()` for main text, `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors#getSecondaryContentColor()` for label text and `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors#getIconColor()` will be used as color for the icon itself. If not set, `https://developer.android.com/reference/androidx/wear/tiles/material/ChipDefaults#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 Chip.Builder [setContentDescription](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.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/Chip`. It is highly recommended to provide this for chip containing icon.

### 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 Chip.Builder [setCustomContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setCustomContent(androidx.wear.tiles.LayoutElementBuilders.LayoutElement))(@NonNull LayoutElementBuilders.LayoutElement content)
```

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

Sets the custom content for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. Any previously added content will be overridden.

### setHorizontalAlignment

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 Chip.Builder [setHorizontalAlignment](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setHorizontalAlignment(int))(int horizontalAlignment)
```

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

Sets the horizontal alignment in the chip. It is strongly recommended that the content of the chip is start-aligned if there is more than primary text in it. By default, `https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders#HORIZONTAL_ALIGN_CENTER()` will be used when only a primary label is present. Otherwise `https://developer.android.com/reference/androidx/wear/tiles/LayoutElementBuilders#HORIZONTAL_ALIGN_START()` will be used.

### 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 Chip.Builder [setIconContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setIconContent(java.lang.String))(@NonNull String imageResourceId)
```

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

Sets the icon for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. Any previously added custom content will be overridden. Provided icon will be tinted to the given content color from `https://developer.android.com/reference/androidx/wear/tiles/material/ChipColors`. This icon should be image with chosen alpha channel and not an actual image. If icon is set, primary label must be set too with `https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setPrimaryLabelContent(java.lang.String)`.

### setPrimaryLabelContent

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 Chip.Builder [setPrimaryLabelContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setPrimaryLabelContent(java.lang.String))(@NonNull String primaryLabel)
```

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

Sets the primary label for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. Any previously added custom content will be overridden. Primary label can be on 1 or 2 lines, depending on the length and existence of secondary label.

### setSecondaryLabelContent

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 Chip.Builder [setSecondaryLabelContent](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setSecondaryLabelContent(java.lang.String))(@NonNull String secondaryLabel)
```

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

Sets the secondary label for the `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. Any previously added custom content will be overridden. If secondary label is set, primary label must be set too with `https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setPrimaryLabelContent(java.lang.String)`.

### setWidth

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 Chip.Builder [setWidth](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setWidth(androidx.wear.tiles.DimensionBuilders.ContainerDimension))(@NonNull DimensionBuilders.ContainerDimension width)
```

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

Sets the width of `https://developer.android.com/reference/androidx/wear/tiles/material/Chip`. If not set, default value will be set to fill the screen.

### setWidth

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 Chip.Builder [setWidth](https://developer.android.com/reference/androidx/wear/tiles/material/Chip.Builder#setWidth(float))(@Dimension(unit = 0) float width)
```

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

Sets the width of `https://developer.android.com/reference/androidx/wear/tiles/material/TitleChip`. If not set, default value will be set to fill the screen.