How do I remove all toast messages currently displayed?
In my App, there is a list, when a user clicks on an item, a toast message is displayed, 10 items - 10 toast messages.
So if the user clicks 10 times, then presses the menu button, they have to wait for some seconds until they're able to read the menu option text.
It shouldn't be like that :)
My solution was to initialize a single Toast in the activity. Then changing its text on each click.
Toast mToast = Toast.makeText(this, "", Toast.LENGTH_SHORT); if (a) { mToast.setText("This is a"); mToast.show(); } else if (b) { mToast.setText("This is b"); mToast.show(); }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With