public void delay() { //give delay before comp can play
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
@Override
public void run() {
startPlay();
}
}, 1500);
}
I made a game having nine buttons such that a player can play against the phone. Each of these buttons calls the delay method above to create a delay between when the player played and when the phone is given a chance to play but as I test the game sometimes the delay is fine but sometimes I notice that the delay is very short as if a call to the delay method has not been made. I would like to know why its happening like this. Thanks.