title: Reschedule timer in android
body: <p>How can I reschedule a timer. I have tried to cancel the timer/timertask and and schedule it again using a method. But its showing an exception error:</p>
  
  <pre>
  Exception errorjava.lang.IllegalStateException: TimerTask is scheduled already
  </pre>
  
  <p>Code I have used it :</p>
  
  <pre>
  private Timer timer = new Timer("alertTimer",true);
  public void reScheduleTimer(int duration) {
      timer.cancel();
      timer.schedule(timerTask, 1000L, duration * 1000L);
  }
  </pre>