title: Best way to restart TimerTask in Service
body: <p>i would like to restart my TimerTask in my Service when i changed the refresh time in the config Activity.</p>
  
  <p>The config Activity changes the public static long UPDATE_INTERVAL</p>
  
  <p>Have you some ideas for me?</p>
  
  <pre><code>public void onStart(Intent intent, int startId) {
  
      // init the service here
      try {
          if (prefs.getString("oauth_token_secret", null) != null) {
              _startService();
          }
          } catch (Exception e) {
              Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_LONG).show();
          }
  
  }
  
  private void _startService() {
  
      timer.scheduleAtFixedRate(
           new TimerTask() {
          public void run() {
  
              //doing things
  
          }
           }, 0, UPDATE_INTERVAL);
  
  }
  </code></pre>
  
  <p>Thanks so far.
  Stefan</p>