# Toast.Callback

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# Callback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/widget/Toast.Callback "View this page in Java")  

```
abstract class Callback
```

|---|----------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                 ||
| ↳ | [android.widget.Toast.Callback](https://developer.android.com/reference/kotlin/android/widget/Toast.Callback#) |

Callback object to be called when the toast is shown or hidden.

## Summary

|                                                Public constructors                                                ||
|----------------------------------------------------------------------------------------------------------------|---|
| [Callback](https://developer.android.com/reference/kotlin/android/widget/Toast.Callback#Callback())`()` <br /> |

|                                                                                                                   Public methods                                                                                                                    ||
|----------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onToastHidden](https://developer.android.com/reference/kotlin/android/widget/Toast.Callback#onToastHidden())`()` Called when the toast is hidden.                |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onToastShown](https://developer.android.com/reference/kotlin/android/widget/Toast.Callback#onToastShown())`()` Called when the toast is displayed on the screen. |

## Public constructors

### Callback

```
Callback()
```

## Public methods

### onToastHidden

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onToastHidden(): Unit
```

Called when the toast is hidden.  

### onToastShown

Added in[API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onToastShown(): Unit
```

Called when the toast is displayed on the screen.