# 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)
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/kotlin/androidx/car/app/model/Banner`.

## Summary

| ### Constants |
|---|---|
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#TYPE_ACTION() = 1` Type indicating the element is an `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`. |
| `const https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#TYPE_IMAGE() = 2` Type indicating the element is an image/icon. |

| ### Public functions |
|---|---|
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#equals(java.lang.Object)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#getAction()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/Action` in this element, or `null` if not set. |
| `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon?` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#getImage()()` Returns the `https://developer.android.com/reference/kotlin/androidx/car/app/model/CarIcon` in this element, or `null` if not set. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#getImageType()()` Returns the image type of the element. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#getType()()` Returns the type of the element. |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#hashCode()()` |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/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)

```
const val TYPE_ACTION = 1: Int
```

Type indicating the element is an `https://developer.android.com/reference/kotlin/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)

```
const val TYPE_IMAGE = 2: Int
```

Type indicating the element is an image/icon.

## Public functions

### equals

```
fun equals(other: Any?): Boolean
```

### getAction

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

```
fun getAction(): Action?
```

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

`https://developer.android.com/reference/kotlin/androidx/car/app/model/Action`s with no `https://developer.android.com/reference/kotlin/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)

```
fun getImage(): CarIcon?
```

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

The host should check `https://developer.android.com/reference/kotlin/androidx/car/app/model/BannerElement#getType()` and `https://developer.android.com/reference/kotlin/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)

```
fun getImageType(): Int
```

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)

```
fun getType(): Int
```

Returns the type of the element.

### hashCode

```
fun hashCode(): Int
```

### toString

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