File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Android and the fly likes [Solved] Clear SurfaceView Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "[Solved] Clear SurfaceView" Watch "[Solved] Clear SurfaceView" New topic

[Solved] Clear SurfaceView

Alexander Schmidt

Joined: Mar 03, 2011
Posts: 2
Hey guys,
I'm new in this Forum and I hope you can help me with a little SurfaceView problem.

An external Thread is calling doDraw:

The doDraw() in MySurfaceView

What I see now, is the image in the background and a line. But if the configuration of the line changes, i don't see the line "moving". There now is a line for every call of doDraw().

I found this in the DevGuide:
On each pass you retrieve the Canvas from the SurfaceHolder, the previous state of the Canvas will be retained. In order to properly animate your graphics, you must re-paint the entire surface. For example, you can clear the previous state of the Canvas by filling in a color with drawColor() or setting a background image with drawBitmap(). Otherwise, you will see traces of the drawings you previously performed.

But I have a background Image and it doesnt help.
So I tried

I even tried to draw a rectangle:

But it's not working.
And now I need your help ;)
Alexander Schmidt

Joined: Mar 03, 2011
Posts: 2
Solved it.
I dont know why i use Path().
I have to use drawLine() instead.
I agree. Here's the link:
subject: [Solved] Clear SurfaceView
It's not a secret anymore!