invalidate()
inside onDraw()
?As per my understanding, calling invalidate()
inside onDraw()
is expensive and is not required if there is no change to the canvas.
invalidate()
equivalent to an asynchronous version of onDraw()
?As per my understanding, they are equivalent. Correct me if I am wrong. Thank you.
Only call invalidate()
if your data has changed and needs to be redrawn. You generally don't do this in onDraw()
, because at that point you are drawing your current data, not changing it. (There are some cases where you may want to do this, such as for running animations, but generally I would recommend instead using a delayed message to control your own timing of the updates.)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With