title: Android - trying to stop ScheduledExecutorService
body: <p>I'm using the next code at on create method of an activity -</p>
  
  <pre><code>        scheduleTaskExecutor = Executors.newScheduledThreadPool(5);
  
  
      scheduleTaskExecutor.scheduleAtFixedRate(new Runnable() {
        public void run() {
         Intent intent = new Intent("com.eample.one.services.action.check");
         startService(intent);
        }
      }, 0, 5000, TimeUnit.MILLISECONDS);
  </code></pre>
  
  <p>As you can see I'm calling with it to a service every 5 seconds.</p>
  
  <p>I've declared the service at the manifest like so -</p>
  
  <pre><code>  &lt;service
          android:name="com.eample.one.services.CheckService"
          android:exported="false" &gt;
          &lt;intent-filter&gt;
              &lt;action android:name="com.eample.one.services.action.check" /&gt;
  
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  </code></pre>
  
  <p>Now at the same activity, which I've declared the ScheduledExecutorService, I have an exit button.</p>
  
  <p>When pressing on it I've tried to stop the ScheduledExecutorService , like so -</p>
  
  <pre><code>    scheduleTaskExecutor.shutdownNow(); 
              finish();
  </code></pre>
  
  <p>Or even</p>
  
  <pre><code>scheduleTaskExecutor.shutdown(); 
     finish();
  </code></pre>
  
  <p>finish() is of course to finish the activity.</p>
  
  <p>But the thing is that scheduleTaskExecutor wouldn't stop after pressing on that button.</p>
  
  <p>Any ideas why is that?</p>
  
  <p>Thanks for any kind of help</p>