# BannerElement

Artifact: [androidx.car.app:app](https://developer.android.com/jetpack/androidx/releases/car-app) [View Source](https://cs.android.com/search?q=file:androidx/car/app/model/BannerElement.java+class:androidx.car.app.model.BannerElement) Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

*** ** * ** ***


```
@ExperimentalCarApi
@CarProtocol
@RequiresCarApi(value = 9)
public final class BannerElement
```

<br />

*** ** * ** ***

An internal wrapper class for elements (actions, icons, images) that can be displayed as leading or trailing items in a `https://developer.android.com/reference/androidx/car/app/model/Banner`.

## Summary

| ### Constants |
|---|---|
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#TYPE_ACTION() = 1` Type indicating the element is an `https://developer.android.com/reference/androidx/car/app/model/Action`. |
| `static final int` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#TYPE_IMAGE() = 2` Type indicating the element is an image/icon. |

| ### Public methods |
|---|---|
| `boolean` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#equals(java.lang.Object)(@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/java/lang/Object.html other)` |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/Action` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getAction()()` Returns the `https://developer.android.com/reference/androidx/car/app/model/Action` in this element, or `null` if not set. |
| `@https://jspecify.dev/docs/api/org/jspecify/annotations/Nullable.html https://developer.android.com/reference/androidx/car/app/model/CarIcon` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getImage()()` Returns the `https://developer.android.com/reference/androidx/car/app/model/CarIcon` in this element, or `null` if not set. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getImageType()()` Returns the image type of the element. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getType()()` Returns the type of the element. |
| `int` | `https://developer.android.com/reference/androidx/car/app/model/BannerElement#hashCode()()` |
| `@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/car/app/model/BannerElement#toString()()` |

## Constants

### TYPE_ACTION

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public static final int TYPE_ACTION = 1
```

Type indicating the element is an `https://developer.android.com/reference/androidx/car/app/model/Action`.

### TYPE_IMAGE

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public static final int TYPE_IMAGE = 2
```

Type indicating the element is an image/icon.

## Public methods

### equals

```
public boolean equals(@Nullable Object other)
```

### getAction

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public @Nullable Action getAction()
```

Returns the `https://developer.android.com/reference/androidx/car/app/model/Action` in this element, or `null` if not set.

`https://developer.android.com/reference/androidx/car/app/model/Action`s with no `https://developer.android.com/reference/androidx/car/app/model/Action#getOnClickDelegate()` should be treated like icons.

### getImage

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public @Nullable CarIcon getImage()
```

Returns the `https://developer.android.com/reference/androidx/car/app/model/CarIcon` in this element, or `null` if not set.

The host should check `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getType()` and `https://developer.android.com/reference/androidx/car/app/model/BannerElement#getImageType()` to determine whether this should be rendered as an icon or an image.

### getImageType

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public int getImageType()
```

Returns the image type of the element.

### getType

Added in [1.9.0-alpha03](https://developer.android.com/jetpack/androidx/releases/car-app#1.9.0-alpha03)

```
public int getType()
```

Returns the type of the element.

### hashCode

```
public int hashCode()
```

### toString

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