ToastNotification provides features to display short and long duration Toasts with customizable IDs and messages. Additionally, it includes an event that fires when a Toast is displayed, allowing developers to take actions in response to displayed Toast notifications.
Code Explanation:
- Show Toast Functions:
ShowShortToast(int id, String message)
: Displays a short duration Toast with the specified message and dispatches theToastShown
event with theid
andmessage
.ShowLongToast(int id, String message)
: Displays a long duration Toast with the specified message and dispatches theToastShown
event with theid
andmessage
.
- Internal
showToast
Method:showToast(int id, String message, int duration)
: Private method that displays the Toast with the specified message and duration, then dispatches theToastShown
event.
ToastShown
Event:ToastShown(int id, String message)
: Event that triggers when a Toast is shown, providing theid
andmessage
as parameters.
Id
Property:Id()
: Getter method to retrieve the currentid
.Id(int id)
: Setter method to set theid
for the notification.
### Video Example
Extension
ToastNotification.aix (6.0 KB)
Thanks.