Anyone know why invalidate must be called by UI thread?
As in Java Swing, the repaint function can be called by both non-UI thread and UI thread. repaint is performing a very similar task as invalidate (this method causes a call to this component’s paint method as soon as possible. Otherwise, this method causes a call to this component’s update method as soon as possible.).
No, they are not the same. There’s also an invalidate method in Swing, and that one does also require the invoker to be invoking it from the EDT/Swing/UI-thread.
Looks like the equivalent to repaint on Android is postInvalidate