I´m trying to let the background transparent in a sequence of frames painted in Canvas in Android 2.2. But it seems that the background does not erase the old frame when a new frame is painted.
How can I erase it?
I´m trying to let the background transparent in a sequence of frames painted in Canvas in Android 2.2. But it seems that the background does not erase the old frame when a new frame is painted.
How can I erase it?
How do I clear (or redraw) the WHOLE canvas for a new layout (= try at the game) ?
Just call Canvas.drawColor(Color.BLACK), or whatever color you want to clear your Canvas with.
And: how can I update just a part of the screen ?
There is no such method that just update a "part of the screen" since Android OS is redrawing every pixel when updating the screen. But, when you're not clearing old drawings on your Canvas, the old drawings are still on the surface and that is probably one way to "update just a part" of the screen.
So, if you want to "update a part of the screen", just avoid calling Canvas.drawColor() method.
u can't erase a canvas. you'll have to draw a color on it each time before a frame.
Canvas.drawColor(Color.BLACK);
//draw frame
it takes a little practice but youll get the trick ecantually