I'm a newbie in java and I'm working on a tic-tac-toe project. I set up a toast to appear when player 1 or 2 wins, but I can't find out how to toast a draw. I got the idea of checking the players' toasts--if they hadn't been displayed, and there are no more empty spaces, then a toast for draw shows up. I can't really figure it out and any help would be very much appreciated
PS im sorry if that was too puzzling, so heres the summary: how can I check if a toast was displayed?
Thanks in advance
Do one thing. Make two variables - p1Won and p2Won. Both the variables should be set to false initially.
boolean p1Won = false;
boolean p2Won = false;
If player 1 wins,
p1Won = true;
And if player 2 wins,
p2Won = true;
But, if you see that there is no free box left, then do this
if (!p1Won && !p2Won)
Toast.makeText(YourActivityName.this, "Draw", Toast.LENGTH_LONG).show();