>From my own investigations, when you are given a Surface to write on,
its contents are undefined but in practice the contents are the
previous buffer used by Android's double buffering (for wallpapers at
least it just flip-flops between buffers).

Hence your flickering, as I think you correctly surmised.

As Nightwolf said, you have to redraw every pixel.

The easy way to do this is to create a bitmap the same size as the
surface/canvas and draw persistent objects to the bitmap exactly as
you are doing now, and then draw the bitmap to the canvas. This
appears to be quite efficient, as its probably just a block copy.





On Feb 17, 7:14 pm, MobileVisuals <eyv...@astralvisuals.com> wrote:
> I am painting polygons with the Paint class in an animation. New
> polygon shapes are created for every new frame. These are painting
> over parts of the screen.
>
> The parts of the screen which are not painted in the new frame flicker
> in a disturbing way. I am using lockCanvas(null); and
> unlockCanvasAndPost(c). Shouldn't this fix the double buffering to
> avoid flickering?
>
> Does anyone know why the flickering occurs and how I can fix this? It
> seems like only the part of the screen that is painted for the new
> frame is double buffered. So I wonder if there is some better way than
> lockCanvas(null); and unlockCanvasAndPost(c) to implement double
> buffering?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to