title: Android Service in background thread
body: <p>I'm trying to create a service that runs in a given interval. The service's purpose is to update a database and when done notify an <code>Activity</code> with an <code>Intent</code>.</p>
  
  <p>The service should also be callable from the activity when the user chooses to 'refresh'. </p>
  
  <p>I have accomplished this, but I can't get it to run in a detached thread.</p>
  
  <p>The service executes an update method in a Runnable:</p>
  
  <pre><code>private Runnable refresh = new Runnable() {
          public void run() {
              update();   //Runs updates
              didUpdate(); //Sends broadcast
              handler.postDelayed(this, 50000); // 50 seconds, calls itself in 50 secs
          }
      };
  </code></pre>
  
  <p>I have another runnable called ManualRefresh that is called via a broadcast from the activity.</p>
  
  <p>However these runnables seem to be blocking the UI. </p>
  
  <p>Need advice! :)</p>