title: Using timer for updating GUI: why it doesn't work?
body: <p>I am creating an application for video recording and I overlayed the video preview with labels <code>txtStatus</code> and <code>txtTime</code>.</p>
  
  <p>The camera button starts/stops the timer which periodically calls the <code>UpdateGUI</code> method. Running the debug I can see the timer is working - it calls <code>updateGUI</code> method every second but the method doesn't update the controls.</p>
  
  <p>I would really appreciate if I could get any hint on how to fix this issue.</p>
  
  <p>Here is the code:</p>
  
  <p>This is the method which activates the timer:</p>
  
  <pre><code>private void startTimer()
  {
      updateTimer = new Timer("TimerUpdate");
      updateTimer.scheduleAtFixedRate(new TimerTask(){
          public void run(){
              settings.IncreaseRecordingTime();
              updateGUI();
  
          }
      }, 0, 1000);
  }
  </code></pre>
  
  <p>This is the updateGUI method:</p>
  
  <pre><code>private void updateGUI()
  {
      setStatusLabel();
      String strTime = settings.GetTimerString(); //strTime changes every second (it works as expected)
      txtTimer.setText(strTime);//the text doesn't change!
  }
  </code></pre>
  
  <p>And this is the method which is called when the button is pressed:</p>
  
  <pre><code>private boolean onCaptureButton()
  {
      settings.CaptureAction();
      videoPreview.setFrameCallback(settings);
      updateGUI();//here the function updateGUI() works as expected - it changes the txtStatus text from "Preview" to "Recording"
      setTimer();
      return false;
  }
  </code></pre>
  
  <p>I added some comments as well (don't know why <code>updateGUI()</code> works when it is called at <code>onCaptureButton()</code> method and doesn't work when called inside the timer method).</p>