how to use postDelayed() correctly in android studio?

后端 未结 3 1756
离开以前
离开以前 2020-11-29 06:41

I have a countDownTimer and if the user does not hit the gameButton within the 12th second I want the gameOver method called. problem I either get game function called insta

3条回答
  •  眼角桃花
    2020-11-29 07:08

        Thread(Runnable {
            // background work here ... 
            Handler(Looper.getMainLooper()).postDelayed(Runnable {
                // Update UI here
            }, 10000) //it will wait 10 sec before upate ui
        }).start()
    

提交回复
热议问题