title: Android dev: updating ui textview using runOnUiThread, crashes
body: <p>My goal is when the user tap start button, letters "o" "n" "o" "m" and so forth will appear at the center of the screen. "o" will appear first then after a few seconds will be replaced by "n" then "o" and so forth.</p>
  
  <p>note: for brevity, i just make the guessword = onomatopoeia, first. In reality, guessword will changes every time i tap the start bottom.</p>
  
  <p>this is the code:</p>
  
  <p>As was suggested, I implemented runonuithread but it still crashes:</p>
  
  <pre><code>public class PlayActivity extends ActionBarActivity {
  
  private String guessword = "onomatopoeia";
  private TextView showchar;
  private int n = guessword.length();
  private char letArray[]= guessword.toCharArray();
  private Handler handler;
  private int i = 0;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_play); 
      handler = new Handler();
      showchar = (TextView) findViewById (R.id.charView);
  }
  
  public void startGame(View view){
      new Thread() {
          public void run() {
              while(i++ &lt; n) {
                  try {
                      runOnUiThread(new Runnable() {
                          @Override
                          public void run() {
                               showchar.setText(letArray[i]);
                          }
                      });
                      Thread.sleep(300);
                  } catch (InterruptedException e) {
                      e.printStackTrace();
                  }
              }
          }
      }.start();
  
  }
  </code></pre>