code: public void delay(int delay) {
          timer.cancel();
          if (delay > 0) {
              timer.schedule(delay);
          } else {
              timer.run();
          }
      }
docs: Cancels any running timers and starts a new one.
  
  @param delay the delay in ms