Stop all toast messages when going to another screen in Android
Solution 1:
Hi I have the same problem. The problem is that the Toast overlaps e.g. if you press 10 times the Toast will stay 10 x LENGTH_SHORT. The only solution I came with was to control the time the Toast is shown by myself. When you show a Toast just keep a track of the last time you show it, it's still on the screen don't show it again. In your worst case the Toast will be visible only LENGTH_SHORT time.
Solution 2:
Toast.makeText
returns a Toast object. You can call cancel()
on this object to cancel it, then show the new one.