After changing a variable, do I have to restart? <p>I have a long running service, that consists of two threads.</p> <pre><code>//MY SERVICE: if(userEnabledProcessOne) //Shared preference value that I'm getting from the settings of my app based on a checkbox processOneThread.start(); if(userEnabledProcessTwo) processTwoThread.start(); </code></pre> <p>Basically, I give the user the option to enable/disable these processes with a checkbox. Now, if the user decides to disable one of the processes <strong>while the service is running</strong>, do I need to restart my service with the updated shared preferences? Like so?</p> <pre><code>//In the settings activity of my app public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { if ( isChecked ) { // Change shared preferences to make the process enabled stopService(myService.class) startService(myService.class) } if (!isChecked) // Change shared preferences to make the process enabled stopService(myService.class) startService(myService.class) } </code></pre> <p>Now that I've changed my shared preferences, do I need to relaunch my service consisting of two threads? Do I need to do anything to the threads? Is this efficient?</p> <p>Thanks so much,</p> <p>Ruchir</p>