title: Android timer updating a textview (UI)
body: <p>I'm using a timer to create a stop watch. The timer works by increasing a integer value. I want to then display this value in the activity by constantly updating a textview. </p>
  
  <p>Here's my code from the service where I try and update the activity's textview: </p>
  
  <pre><code>protected static void startTimer() {
      isTimerRunning = true; 
      timer.scheduleAtFixedRate(new TimerTask() {
          public void run() {
              elapsedTime += 1; //increase every sec
              StopWatch.time.setText(formatIntoHHMMSS(elapsedTime)); //this is the textview
          }
      }, 0, 1000);
  }
  </code></pre>
  
  <p>I got some kind of error about updating the UI in the wrong thread. </p>
  
  <p>How can I adapt my code to accomplish this task of constantly updating the textview? </p>