How to control the amount of Toasts that are displayed without them forming a display queue?

Asked

Viewed 49 times

1

I’m developing an Android app that’s basically a game. In the main Activity there is a start button and other buttons that are also part of the game, but if the user presses any other button than the start button, a Toast is displayed asking him to press the start button. The problem is that it can press other buttons several times, flooding the screen of Toasts that repeat the number of times that were requested.

The desirable thing is that there was no queue, IE, Toast only be displayed if there is no other Toast on display.

  • I recommend another way, you can leave the buttons invisible, and when you click on the start then leave visible again, so will leave the screen cleaner and will not have the problem of Toast

  • Unfortunately I can’t let the buttons invisible, it would mess with the interface of the game. I was more looking for some method inherent to the Toast class that returns a value for if there is a Toast being displayed, so it would only be to check the state of that variable and only display the Toast if it was not "set".

  • Does it serve to leave it disabled? So it will not respond to any click action

  • Actually Toast would help the user to know that this button is what starts the game, so I see it as necessary. I just didn’t want it to be displayed multiple times if the user pressed the button several times.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.