A Toast is a message that pops up on the surface of the window. It only fills the amount of space required for the message and the user’s current activity remains visible and interactive. The notification automatically fades in and out, and does not accept interaction events.
Toast is transient notifications that stay visible for less than a few seconds before fading out. Toast don’t take focus and its not a modal, so that they don’t interrupt the application. You can also use it for debugging purpose. A toast provides simple feedback about an operation in a small popup.
Toasts are excellent for informing your users of events without forcing them to open an Activity or browse a Notification. they provide a perfect mechanism for alerting users to events occurring in background Services without interrupting foreground applications. Generally, your application should show Toasts only if one of its Activities is active.
For detailed explanation of code, visit here.
👉 Watch it here.
Reach out to me at surender@androhub.com.
Donate for the free content.