在我使用的定时器中,如何在按下按钮时增加一个时间? 例如,我想在按下按钮时,millisUntilFinished增加5秒。我试过用全局变量,但没有成功。
object :CountDownTimer(10000,1000){
override fun onFinish() {
timeText.text = "Left : 0"
handler.removeCallbacks(runnable)
for (image in imageArray){
image.visibility = View.INVISIBLE
for (add in timeAdd){
add.visibility = View.INVISIBLE
button.visibility = View.VISIBLE
override fun onTick(millisUntilFinished: Long) {
timeText.text = "Left : "+millisUntilFinished/1000
}.start()