title: Is there already a StopWatch class for android and why doesn't my implementation work?
body: <p>Lately I saw <a href="http://developer.android.com/reference/android/os/CountDownTimer.html">http://developer.android.com/reference/android/os/CountDownTimer.html</a> and wondered if there is an respective class for stop watches since I want to tell the user of my App how long he's already trying to solve the puzzle. I mean it isn't that complicated to program such a stop watch on your own. I tried something like</p>
  
  <pre><code>    Runnable runnable = new Runnable() {
          @Override
          public void run() {
              while (true) {
                  try {
                      Thread.sleep(1000);
                  } catch (InterruptedException e) {
                  }
                  long seconds = (System.currentTimeMillis() - t) / 1000;
                  statusBar.setText(String.format("%02d:%02d", seconds / 60, seconds % 60));
              }
          }
  
      };
      statusBar.post(runnable);
  </code></pre>
  
  <p>But bizarrely the layout of my activity isn't inflated anymore since I have this <code>statusBar.post(runnable);</code> in the end of the acitivity's <code>onCreate</code> method meaning that after starting the app I only see a white screen instead of the normal gui.</p>