Android thread problem
<p>I just want to continously update text in an android app. However my App crashes every time.</p>

<p>This is my code:</p>

<pre><code>package org.pgvw.main;

import android.app.Activity;
import android.os.Bundle;
import android.widget.TextView;

public class InertialView extends Activity {
    TextView tv;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        tv = new TextView(this);
        tv.setText("Time: ");
        new Thread(new Runnable() {
            public void run() {
                while(true) {
                    try {
                        Thread.currentThread().sleep(100);
                        tv.setText("Time: " + System.currentTimeMillis());
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                }
            }
        }).start();
        setContentView(tv);
    }
}
</code></pre>

<p>Can anyone spot the mistake?</p>

<p>Greetings and thx!</p>
