pranavpandey / dynamic-toasts

Custom toasts with color and icon on Android.
https://dynamic.pranavpandey.com
Apache License 2.0
159 stars 25 forks source link

update a toast #3

Closed Mahdiazadbar closed 6 years ago

Mahdiazadbar commented 6 years ago

how can update a DynamicToast? i have multiple toast and we need to show it in default of dynamic toast it show consequently and for example for 10 toast it show for 1 minute and one by one. but we need update last toast to new toast text and style. how can i do this?

pranavpandey commented 6 years ago

DynamicToast returns an object of the default Android Toast. You can store it in a Toast object and use the cancel() method to stop showing this toast. After that, create another toast with the updated content. Please check the pseudo code below:

Toast toast = DynamicToast.make(...); // Create a dynamic toast.
toast.show(); // Show the toast.
toast.cancel(); // Stop showing this toast.

// Optional, do any modifications via DynamicToast.Config.getInstance().

toast = DynamicToast.make(...); // New dynamic toast.
tost.show(); // Show the new toast.
...
pranavpandey commented 6 years ago

Closing it for now. Feel free to share your feedback.