# AlertCallback

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/AlertCallback.java+class:androidx.car.app.model.AlertCallback) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/car-app#1.2.0)

*** ** * ** ***


```
@CarProtocol
@RequiresCarApi(value = 5)
public interface AlertCallback
```

<br />

*** ** * ** ***

A listener of dismiss events.

## Summary

| ### Constants |
|---|---|
| `default static final int` | `https://developer.android.com/reference/androidx/car/app/model/AlertCallback#REASON_NOT_SUPPORTED() = 3` Indicates the cancellation is due to the request not being supported, e.g. when current template cannot display the alert. |
| `default static final int` | `https://developer.android.com/reference/androidx/car/app/model/AlertCallback#REASON_TIMEOUT() = 1` Indicates the cancellation is due to timeout. |
| `default static final int` | `https://developer.android.com/reference/androidx/car/app/model/AlertCallback#REASON_USER_ACTION() = 2` Indicates the cancellation is due to user generated action, e.g. close button being pressed. |

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/car/app/model/AlertCallback#onCancel(int)(int reason)` Notifies that a cancel event happened with given `reason`. |
| `abstract void` | `https://developer.android.com/reference/androidx/car/app/model/AlertCallback#onDismiss()()` Notifies that a dismiss happened. |

## Constants

### REASON_NOT_SUPPORTED

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

```
default static final int REASON_NOT_SUPPORTED = 3
```

Indicates the cancellation is due to the request not being supported, e.g. when current template cannot display the alert.

### REASON_TIMEOUT

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

```
default static final int REASON_TIMEOUT = 1
```

Indicates the cancellation is due to timeout.

### REASON_USER_ACTION

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

```
default static final int REASON_USER_ACTION = 2
```

Indicates the cancellation is due to user generated action, e.g. close button being pressed.

## Public methods

### onCancel

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

```
abstract void onCancel(int reason)
```

Notifies that a cancel event happened with given `reason`.

### onDismiss

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

```
abstract void onDismiss()
```

Notifies that a dismiss happened.