title: Stop service doesn't work on android
body: <p>I'm a student new to android, and I have an application which use background service.
  I want to start/stop the service by clicking on a button, i'm doing it like this:</p>
  
  <pre><code>case R.id.enablepop:
          if (!(pop.runningFlag))
              startService(new Intent(mainScreen,PopUpService.class));
          return true;
  case R.id.disablepop:
          if (pop.runningFlag)
                  stopService(new Intent(mainScreen,PopUpService.class));
          return true;
  </code></pre>
  
  <p>In the onStart() function of the service I have runningFlag which I set to "true", then I create a thread that works while runningFlag is true.
  I set the runningFlag to false on onDestroy().</p>
  
  <p>The problem is that the service won't stop. Can someone help me plz? </p>