Publisher closed input channel or an error occurred. events=0x8

点点圈 提交于 2019-12-02 22:40:17

Are you actually seeing a problem, or just being troubled by the error message? This message is printed I believe when the client side of the input event pipe fails because the server has closed the connection. This could happen for example if you don't close a window when your activity is being destroyed.

Place a try, catch block around the code that draws the canvas.

More specifically:

Canvas canvas = null;

    try {
        canvas = _surfaceHolder.lockCanvas(null);
        synchronized (_surfaceHolder) 
        {
            onDraw(canvas);
        }

        if(canvas != null)
        {
            _surfaceHolder.unlockCanvasAndPost(canvas);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!