Stay organized with collections
Save and categorize content based on your preferences.
Callback
abstract class Callback
Callback object to be called when the toast is shown or hidden.
Summary
Public methods |
open Unit |
Called when the toast is hidden.
|
open Unit |
Called when the toast is displayed on the screen.
|
Public constructors
Public methods
onToastHidden
open fun onToastHidden(): Unit
Called when the toast is hidden.
onToastShown
open fun onToastShown(): Unit
Called when the toast is displayed on the screen.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# Toast.Callback\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nCallback\n========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/Toast.Callback \"View this page in Java\") \n\n```\nabstract class Callback\n```\n\n|---|------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.widget.Toast.Callback](#) |\n\nCallback object to be called when the toast is shown or hidden.\n\nSummary\n-------\n\n| Public constructors ||\n|------------------------------------|---|\n| [Callback](#Callback())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|---------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onToastHidden](#onToastHidden())`()` Called when the toast is hidden. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onToastShown](#onToastShown())`()` Called when the toast is displayed on the screen. |\n\nPublic constructors\n-------------------\n\n### Callback\n\n```\nCallback()\n```\n\nPublic methods\n--------------\n\n### onToastHidden\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onToastHidden(): Unit\n```\n\nCalled when the toast is hidden. \n\n### onToastShown\n\nAdded in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onToastShown(): Unit\n```\n\nCalled when the toast is displayed on the screen."]]