Can anyone explain me the use of invalidate() function and when it needs to be called

It marks the entire surface of the view as needing repainting, thus causing the control to repaint itself at the earliest convenient moment on the UI thread (once all other UI actions have completed).

You would most likely only need to call this if you have a custom view on which you are doing manual painting, and the state has changed in such a way that what is drawn will need changing. Rather than manually try and get the graphics canvas and paint on the fly, you would call invalidate() so that the view's onDraw() eventually gets called, the preferred point for doing custom drawing.

This is equivalent to desktop Java's repaint() call.


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

Reply via email to