setText causing a crash
<p>For the better part of every day for the past week, I have been working on this project of controlling a textfield with the input of a potentiometer, and my setText command keeps crashing the program. I'm tired of tinkering and debugging but getting very little accomplished, and I need some help badly.</p>

<p>If you need to see all of the projects files, I can upload them as well.</p>

<p>Search for "This line causes a crash"</p>

<pre><code>package edu.uidaho.pong;

import java.io.IOException;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.os.Handler;
import android.os.Message;
import android.widget.Toast;
import android.app.Activity;

import android.view.SurfaceHolder;

public class GameThread extends Thread {


    /** Handle to the surface manager object we interact with */
    private SurfaceHolder _surfaceHolder;
    private Paint _paint;
    private GameState _state;
    public PongActivity _pong;

    public GameThread(SurfaceHolder surfaceHolder, Context context,
            Handler handler) {
        _surfaceHolder = surfaceHolder;
        _paint = new Paint();
        _state = new GameState();
        _pong = new PongActivity();

    }

//  @Override
    public void run() {
        while (true) {
            Canvas canvas = _surfaceHolder.lockCanvas();
            _state.update(_pong);
            _state.draw(canvas, _paint);
            _surfaceHolder.unlockCanvasAndPost(canvas);


            int ret = 0;
            byte[] buffer = new byte[16384];
            int i;

            int tempdebug = 0;
            //while (true) { // read data
            while (tempdebug++ &lt; 10){
//              try {
//                  ret = _pong.mInputStream.read(buffer);
//              } catch (IOException e) {
//                  break;
//              }
                ret = 5; // let's pretend there's a 5 every time since I can't test the usb

                i = 0;
                while (i &lt; ret) {
                    int len = ret - i;
                    if (len &gt;= 1) {
                        Message m = Message.obtain(_pong.mHandler);
                        int value = (int)buffer[i];
                        // 'f' is the flag, use for your own logic
                        // value is the value from the arduino
                        m.obj = new ValueMsg('f', value);
                        _pong.mHandler.sendMessage(m);
                    }
                    i += 1; // number of bytes sent from arduino
                }
            }
            //_pong.mResponseField.setText("Reading: "); This line causes a crash

        }
    }

    public GameState getGameState() {
        return _state;
    }
}
</code></pre>

<p>Logcat output -</p>

<pre><code>03-03 22:45:49.639: W/dalvikvm(381): threadid=9: thread exiting with uncaught exception (group=0x40015560)
03-03 22:45:49.639: E/AndroidRuntime(381): FATAL EXCEPTION: Thread-10
03-03 22:45:49.639: E/AndroidRuntime(381): java.lang.NullPointerException
03-03 22:45:49.639: E/AndroidRuntime(381):  at edu.uidaho.pong.GameThread.run(GameThread.java:70)
03-03 22:45:50.189: E/global(381): Deprecated Thread methods are not supported.
03-03 22:45:50.189: E/global(381): java.lang.UnsupportedOperationException
03-03 22:45:50.189: E/global(381):  at java.lang.VMThread.stop(VMThread.java:85)
03-03 22:45:50.189: E/global(381):  at java.lang.Thread.stop(Thread.java:1280)
03-03 22:45:50.189: E/global(381):  at java.lang.Thread.stop(Thread.java:1247)
03-03 22:45:50.189: E/global(381):  at edu.uidaho.pong.GameView.surfaceDestroyed(GameView.java:46)
03-03 22:45:50.189: E/global(381):  at android.view.SurfaceView.reportSurfaceDestroyed(SurfaceView.java:587)
03-03 22:45:50.189: E/global(381):  at android.view.SurfaceView.updateWindow(SurfaceView.java:481)
03-03 22:45:50.189: E/global(381):  at android.view.SurfaceView.onWindowVisibilityChanged(SurfaceView.java:213)
03-03 22:45:50.189: E/global(381):  at android.view.View.dispatchWindowVisibilityChanged(View.java:4027)
03-03 22:45:50.189: E/global(381):  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
03-03 22:45:50.189: E/global(381):  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
03-03 22:45:50.189: E/global(381):  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
03-03 22:45:50.189: E/global(381):  at android.view.ViewGroup.dispatchWindowVisibilityChanged(ViewGroup.java:720)
03-03 22:45:50.189: E/global(381):  at android.view.ViewRoot.performTraversals(ViewRoot.java:782)
03-03 22:45:50.189: E/global(381):  at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)
03-03 22:45:50.189: E/global(381):  at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 22:45:50.189: E/global(381):  at android.os.Looper.loop(Looper.java:130)
03-03 22:45:50.189: E/global(381):  at android.app.ActivityThread.main(ActivityThread.java:3683)
03-03 22:45:50.189: E/global(381):  at java.lang.reflect.Method.invokeNative(Native Method)
03-03 22:45:50.189: E/global(381):  at java.lang.reflect.Method.invoke(Method.java:507)
03-03 22:45:50.189: E/global(381):  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-03 22:45:50.189: E/global(381):  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-03 22:45:50.189: E/global(381):  at dalvik.system.NativeStart.main(Native Method)
</code></pre>
