1

I have some experience with the SurfaceView. To prevent unneeded redrawing, I always use a countdown variable which tells the thread how often the view should be drawn.

countdown > 0 : draw ? doNothing

However I was thinking about changing that to use a "push surface". So just push a buffer to the surface and show that instead of setting a countdown variable everywhere in my project.

My problem is that I can't find a good tutorial/resource where the usage is described. Currently I have something like this:

// panel is the SurfaceView
c = panel.getHolder().lockCanvas(null);
synchronized (panel.getHolder()) {
    panel.updatePhysics();
    panel.onDraw(c);
}
panel.getHolder().unlockCanvasAndPost(c);

I have no idea on how to get the canvas to draw on when I can't use lockCanvas() as mentioned in the documentation.

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150

1 Answers1

0

This question is obsolete after making the surface types deprecated. So it isn't used anymore...

WarrenFaith
  • 57,492
  • 25
  • 134
  • 150
  • 1
    Depends. If you're trying to use the CameraPreview, as in the SDK 7 samples, `SURFACE_TYPE_PUSH_BUFFERS` is required. If you fail to set this type, the preview won't work. So there must be an interpretation somewhere in the camera API, even though the types are marked deprecated. – rdoubleui Jun 13 '11 at 21:34