在finish一个带有自定义SurfaceView的Activity时发生报错

在finish一个带有自定义SurfaceView的Activity时发生报错

I/ple.planebattl: Thread[6,tid=5848,WaitingInMainSignalCatcherLoop,Thread*=0xe21c1c10,peer=0x13080280,"Signal Catcher"]: reacting to signal 3
I/ple.planebattl: 
I/ple.planebattl: Wrote stack traces to tombstoned

以下是最有可能发生错误的地方:


```java
@Override
    public void run() {
        SurfaceView surfaceView = findViewById(R.id.surfaceView);
        surfaceviewwidth=surfaceView.getWidth();
        surfaceviewheight=surfaceView.getHeight();
        x=surfaceView.getWidth()/2+myplanebit.getWidth();
        y=surfaceView.getHeight()-myplanebit.getHeight()-100;
        timer = new Timer();
        timerTask = new TimerTask() {
            @Override
            public void run() {
                bullet();
            }
        };
        timer.schedule(timerTask,0,300);

        timer2 = new Timer();
        timerTask2 = new TimerTask() {
            @Override
            public void run() {
                enemy();
            }
        };
        timer2.schedule(timerTask2,500,150);

        timer3 = new Timer();
        timerTask3 = new TimerTask() {
            @Override
            public void run() {
                boss();
            }
        };
        timer3.schedule(timerTask3,5000);

        //背景画布
        while (mIsDrawing) {
            long start = System.currentTimeMillis();
            count++;
            if(count>=10000) count = 0;
            draw();//draw总方法

            long end = System.currentTimeMillis();
            if (end - start < 20) {
                try {
                    Thread.sleep(20 - (end - start));
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }finally {
                    if (mCanvas != null){
                        //释放canvas对象并提交画布
                        mSurfaceHolder.unlockCanvasAndPost(mCanvas);
                    }
                }
            }
        }
    }

```

SurfaceView是UI操作,不能放在多线程中。
你需要用多线程在Handler的方式做