Android graphics draw on a canvas question -


I'm writing my first Android app so it's still in the learning stages.

Its very simple, I draw a graphic in the center of the screen and simultaneously touch the event to the graphic to the point where the user touches it for a thread ontouch event Will start and update the graphic. The problem is that the canvas dial () is working when calling from onDraw (), but does not update the canvas / screen when the call is made from within the thread

DrawSplash my function (Canvas c, location l);

I call both the on-the-draw () and the same functions in the thread.

I can see that the only difference in that code is that I am accumulating that canvas object in my class in a variable in the Ondau () function, so that I can use it again in the thread. It seems somehow wrong. If so, what is the right way to do this? Can I get canvas object any time? How do i do this

  • P

    to you .invalidate () The onDraw method for your view is overrited with. Every time it is said that it should draw the graphics to the correct position.

    And you Inside the thread should call the .invalidate () method.

Comments