Im using
public class MyWallpaperService extends WallpaperService
public Engine onCreateEngine() { return new MyWallpaperEngine(); }
in MyWallpaperEngine im doing this after touch
private class MyWallpaperEngine extends Engine
public void onTouchEvent(MotionEvent event) {
SurfaceHolder holder = getSurfaceHolder();
Canvas canvas = null;
try {
canvas = holder.lockCanvas();
drawCircles(canvas, circles);
}
finally {
if (canvas != null)
holder.unlockCanvasAndPost(canvas); //this is 86 line
}
super.onTouchEvent(event);
}
but it throws a Exceptions:
11-16 20:36:14.556: E/Surface(7304): queueBuffer: error queuing buffer to SurfaceTexture, -19
11-16 20:36:14.556: E/Surface(7304): queueBuffer (handle=0xb7bc2a30) failed (No such device)
11-16 20:36:14.556: E/AndroidRuntime(7304): FATAL EXCEPTION: main
11-16 20:36:14.556: E/AndroidRuntime(7304): java.lang.IllegalArgumentException
11-16 20:36:14.556: E/AndroidRuntime(7304): at android.view.Surface.nativeUnlockCanvasAndPost(Native Method)
11-16 20:36:14.556: E/AndroidRuntime(7304): at android.view.Surface.unlockCanvasAndPost(Surface.java:255)
11-16 20:36:14.556: E/AndroidRuntime(7304): at com.android.internal.view.BaseSurfaceHolder.unlockCanvasAndPost(BaseSurfaceHolder.java:215)
11-16 20:36:14.556: E/AndroidRuntime(7304): at com.example.wallparer.MyWallpaperService$MyWallpaperEngine.onTouchEvent(MyWallpaperService.java:86)
Have no idea why? ...