I want my app to wait for a moment before changing the button text. I tried different things (wait(), Thread.sleep) but since I want the waiting time to be variable, I decided to make use of CountDownTimer. See the code below:
public void onClick(View buttonClicked) { if (i == 0) { button.setText("Wait"); waitingTime = (long) (Math.random() * 1000 + 10000); new countdown(waitingTime, 1000); time1 = System.currentTimeMillis(); button.setText("Press"); i++;
For some reason this doesn´t work, and the program does not wait at all. Can anyone please help me? I did not fill the CountDownTimer with anything since I figured that it should only wait for a couple of seconds.