How to set delay in Android onClick function

前端 未结 5 1600
借酒劲吻你
借酒劲吻你 2020-11-29 09:03

) I\'m in a process of creating a memory game. My problem is that whenever i click for the second time, i can\'t even see toggled button. To be clear - first click toggles t

5条回答
  •  情深已故
    2020-11-29 09:51

    Do not sleep in the UI thread. You need another thread that will look for a "wake up and wait" message from your UI thread. That second thread could then do your hiding after a normal sleep call. You could then keep the thread around for the next time you need to hide something, or kill it and whip up a new one each time you need another delay.

    I believe there are some "postFoo" functions that might be useful in this context (triggering UI events from outside the UI thread).

提交回复
热议问题