title: How to check if a timer is still running or not?
body: <p>I try to send sms in service.If the sms is not sent means I restart the service after some time, for that I Using the timer.If the sms sent means I want to stop the timer,for stop the timer I use timer.cancel(); before that I've to check the timer is running or not.how to check it?. </p>
  
  <pre><code>             int resultCode = getResultCode();
                   switch (resultCode) 
                   {
                  case Activity.RESULT_OK:                 
                               timer.cancel();//Here I want to check timer running or not
                   break;
  
                   case SmsManager.RESULT_ERROR_GENERIC_FAILURE:  
                       timer_run();
                   break;
  
                   case SmsManager.RESULT_ERROR_NO_SERVICE:     
                       timer_run();
                   break;
  
                   case SmsManager.RESULT_ERROR_NULL_PDU:        
                        timer_run();
                    break;
  
                   case SmsManager.RESULT_ERROR_RADIO_OFF:        
                       timer_run();
                    break;
  
                   }
  </code></pre>
  
  <p>Timer Schedule function</p>
  
  <pre><code>    public void timer_run(){        
  
      TimerTask hourlyTask = new TimerTask () {
          @Override
          public void run () {
               Intent myIntent = new Intent(Myservice.this,Myservice.class); 
               startService(myIntent);
  
  
          }
      };
       timer.schedule (hourlyTask, 0l, 500*5*5);
     }    
  </code></pre>