My answer to this question was just accepted but I started to wonder when exactly one needs to invalidate() a View and when it is not necessary?
After a bit of thinking I came to realization that it should work more or less like this:
- actual drawing of "everything" occurs after
onResume()
- in "free" time parts of the screen can be redrawn but only those that were
invalidated
(and everything underneath)
Therefore, it would seem, if I change something after onResume()
(e.g. as a response to a button click, I should invalidate()
the changed View
).
However, from what scana in this question says, it must be more complex then that and it depends somethimes on what method one uses.
E.g. on whether one uses
lastClicked.setImageBitmap();
or
lastClicked.setImageResource();
So, when it's necessary to execute invalidate() on a View and how does it really work ?