Run code over and over
<p>In my application I am showing a clock in a <code>TextView</code>, and I want to update it in real time. I tried to run it like this:</p>

<pre><code>public void clock() {
    while(clock_on == true) {
        executeClock();
    }
}

public void executeClock() {
    TextView timeTv = (TextView) findViewById(R.id.time);
    long currentTime=System.currentTimeMillis();
    Calendar cal=Calendar.getInstance();
    cal.setTimeInMillis(currentTime);
    String showTime=String.format("%1$tI:%1$tM %1$Tp",cal);
    timeTv.setText(showTime);
}
</code></pre>

<p>But it doesn't work.</p>
