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 Thread at the end of onCreate method.
Thread thread = new Thread(this);
thread.run();
This is the run method
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();
            }
        }
    } 
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?