문제

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.

도움이 되었습니까?

해결책

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

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top