开发者

How do I refresh the Screen before a method ends in droid?

开发者 https://www.devze.com 2023-01-22 09:46 出处:网络
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 m

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消