Reputation: 390
I am trying to use Canvas and Bitmaps to draw in my activity, but I am not getting a hold of things like:
this.invalidate
does not seem to do the trick).Can someone explain these? (Example code would be an extra plus). Thanks :)
Upvotes: 0
Views: 129
Reputation: 164
onDraw() is initially called by the system sometime after inflating the layout containing the View. If you setContentView() in your onCreate(), for example, you have at least until onCreate() returns before it will be drawn because the UI thread must go idle in order for a draw to occur.
invalidate() is the way to do this. Don't call it from within onDraw or you'll be in an infinite loop.
Again, use invalidate() whenever you need a redraw. That is its purpose.
Upvotes: 1