Android IllegalThreadStateException in LunarLander

前端 未结 3 447
慢半拍i
慢半拍i 2021-01-24 09:04

Just come to polishing my application and making it resume after the user has left. When the application restores I get an IllegalThreadStateException, which is quite annoying.

3条回答
  •  佛祖请我去吃肉
    2021-01-24 09:41

    In my own test, I create the drawing thread in the surfaceCreated() method, and this solves the issue completely. This is my method implementation:

    @Override
    public void surfaceCreated(SurfaceHolder arg0) {
        _thread = new DrawThread(getHolder());
        _thread.setRunning(true);
        _thread.start();
    }
    

提交回复
热议问题