How do I refresh the Screen before a method ends in droid?
If I change one ImageView
's source to another, (and thus changing the Image) but then have more changes occur within the method and such. How can I force it to refresh to show the changes before the method ends? (As waiting for the method to end to show 开发者_JS百科the changed images is not good for my purposes at all)
There's a Very Similar question that has an excellent answer (and a link to another similar question) right here.
Basically, unless you create a thread on your own, you're running in the UI thread. Invalidate/sleep just pauses rendering/input/etc. Your redraw()
is only called in the UI thread after your current function exits. You want to separate the two, or use a lower-level technique (postInvalid()
in another thread, or SurfaceView
w/ repaint()
respectively).
精彩评论