Android: When to call invalidate()? -


i'm using matrix rotate png image on screen. want move rotation operation separate thread ui thread isn't burdened it. raises interesting questions.

i expected need call invalidate() once matrix applied imageview. however, rotated image appearing fine on screen - , never call invalidate(). there no touch areas, nothing i'm doing explicitly tell ui refresh screen. stimulating ui thread update display? ui thread magically "know" display needs updated (and therefore explicit call invalidate() not necessary) because thread touching object part of display?

when move rotation out of ui thread, manipulating same imageview ui uses render screen. sounds classic thread conflict problem require synchronization (because same object accessed multiple threads). because of above behavior, i'm not sure how handled. since ui thread seems "magically know" screen needs updated, need synchronize - or separate thread call invalidate() on view , take care of it?

thanks!

i believe postinvalidate() non-ui thread, opposed invalidate() when on ui thread.

but yes.

just call this, , update on next given chance.


Comments