gpt4 book ai didi

android - 墙纸因错误而崩溃 - queueBuffer : error queuing buffer to SurfaceTexture

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:48:48 35 4
gpt4 key购买 nike


动态壁纸崩溃,代码如下

public void render(){


Canvas canvas = null;
try{

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

}catch(Exception e){ Log.w("Surface holder ", e.toString());}

finally{
if(canvas != null){
this._surfaceHolder.unlockCanvasAndPost(canvas);
}
}
}

protected void onDraw(Canvas canvas) {
this.renderBackGround(canvas);
for (Renderable renderable : this._fishes) {
renderable.render(canvas);
}
};

崩溃并出现以下错误

06-07 19:49:09.143: E/SurfaceTextureClient(13629): queueBuffer: 到 SurfaceTexture 的错误排队缓冲区,-19

06-07 19:49:09.143: E/SurfaceTextureClient(13629):queueBuffer (handle=0x1c1b30) 失败(没有这样的设备)06-07 19:49:09.143: W/dalvikvm(13629): threadid=11: 线程以未捕获的异常退出 (group=0x40c671f8)06-07 19:49:09.143: E/安卓运行时 (13629):致命异常:Thread-692

06-07 19:49:09.143: E/AndroidRuntime(13629): java.lang.IllegalArgumentException

06-07 19:49:09.143: E/AndroidRuntime(13629): 在 android.view.Surface.unlockCanvasAndPost(本地方法)

06-07 19:49:09.143: E/AndroidRuntime(13629): 在 com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)

提前致谢

最佳答案

这通常发生在您在动态壁纸选择器中旋转设备时。我找到的唯一解决方案是捕获 IllegalArgumentException 并忽略它。

if (canvas != null) {
try {
holder.unlockCanvasAndPost(canvas);
} catch (IllegalArgumentException e) {
// Ignore weird bug when rotating in live wallpaper picker
}
}

关于android - 墙纸因错误而崩溃 - queueBuffer : error queuing buffer to SurfaceTexture,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10938469/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com