title: Implementing Runnable in MainActivity
body: <p>I have a very simply activity that prints a custom date time string to a textView. I implemented a runnable interface in the MainActivity it self and created a <code>Thread</code> at the end of <code>onCreate</code> method.</p>
  
  <pre><code>Thread thread = new Thread(this);
  thread.run();
  </code></pre>
  
  <p>This is the run method </p>
  
  <pre><code>public void run() {
  
          while (true) {
              try {
                  Thread.sleep(1000);
                  localTime.setText(LocalTime.getTime().format2445());
                  System.out.println(LocalTime.getTime().format2445());
              } catch (InterruptedException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
  
          }
  
      } 
  </code></pre>
  
  <p>When i run it on the emulator i can see the System out in logcat. But the emulator shows ANR after about 5 seconds. What am i doing wrong. Is this method not suitable? is Async Task is the way to go here? I need to update the clock every second so is having a AsyncTask run forever is an acceptable pattern?</p>