Kotlin Android Toast
Android Toast is used to display a sort time notification to the user without affecting the user interaction with UI. The message displayed using Toast class displays quickly, and it disappears after some time. The message in the Toast can be of type text, image or both.
To learn more about Android Toast, go to Android Toast Example
Kotlin Android Toast Example
In this example, we will display a toast message by clicking on a Button. See the following example:
Add the following code in the activity_main.xml file. In this file, we have added a button to the layout to perform a click action.
Add the following code in the MainActivity.kt class. In this class, we are performing a click action on the button which displays the toast message.