我正在使用线程来处理墙纸并使用表面视图。我收到以下错误并且无法解决。有一个答案,他们说 locksurfaceHolder.lockcanvas()
和的顺序有问题surfaceHolder.unlockCanvasAndPost(canvas)
。但我检查了一下,它是正确的。请帮助某人.. LogCat 如下:
07-06 12:58:24.459: E/SurfaceTextureClient(719): queueBuffer: error queuing buffer to SurfaceTexture, -19
07-06 12:58:24.459: E/SurfaceTextureClient(719): queueBuffer (handle=0x2a185508) failed (No such device)
07-06 12:58:24.470: W/System.err(719): java.lang.IllegalArgumentException
07-06 12:58:24.479: W/System.err(719): at android.view.Surface.nativeUnlockCanvasAndPost(Native Method)
07-06 12:58:24.489: W/System.err(719): at android.view.Surface.unlockCanvasAndPost(Surface.java:457)
07-06 12:58:24.489: W/System.err(719): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
07-06 12:58:24.489: W/System.err(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector$LeafThread.run(BackgroundSelector.java:160)
07-06 12:58:24.630: E/SurfaceTextureClient(719): dequeueBuffer failed (No such device)
07-06 12:58:24.649: E/InputEventReceiver(719): channel '40ee2318 com.shagun.sunsetlivewallpaper.WallpaperService (client)' ~ Publisher closed input channel or an error occurred. events=0x9
07-06 12:58:24.690: E/BaseSurfaceHolder(719): Exception locking surface
07-06 12:58:24.690: E/BaseSurfaceHolder(719): java.lang.IllegalArgumentException
07-06 12:58:24.690: E/BaseSurfaceHolder(719): at android.view.Surface.nativeLockCanvas(Native Method)
07-06 12:58:24.690: E/BaseSurfaceHolder(719): at android.view.Surface.lockCanvas(Surface.java:447)
07-06 12:58:24.690: E/BaseSurfaceHolder(719): at com.android.internal.view.BaseSurfaceHolder.internalLockCanvas(BaseSurfaceHolder.java:184)
07-06 12:58:24.690: E/BaseSurfaceHolder(719): at com.android.internal.view.BaseSurfaceHolder.lockCanvas(BaseSurfaceHolder.java:157)
07-06 12:58:24.690: E/BaseSurfaceHolder(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector$LeafThread.run(BackgroundSelector.java:145)
07-06 12:58:24.690: W/dalvikvm(719): threadid=12: thread exiting with uncaught exception (group=0x40a70930)
07-06 12:58:24.719: E/AndroidRuntime(719): FATAL EXCEPTION: Thread-68
07-06 12:58:24.719: E/AndroidRuntime(719): java.lang.NullPointerException
07-06 12:58:24.719: E/AndroidRuntime(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector.drawScreen(BackgroundSelector.java:85)
07-06 12:58:24.719: E/AndroidRuntime(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector.access$1(BackgroundSelector.java:80)
07-06 12:58:24.719: E/AndroidRuntime(719): at com.shagun.sunsetlivewallpaper.BackgroundSelector$LeafThread.run(BackgroundSelector.java:148)
07-06 12:58:30.680: I/Process(719): Sending signal. PID: 719 SIG: 9