이안드로이드 : 마무리() CountDownTimer의은()를 호출 취소하더라도이라고
새로운 CountDownTimer (15000, 15) 버튼을 클릭 I에 {
public void onTick(long millisUntilFinished) {
long seconds=millisUntilFinished/1000;
long min=millisUntilFinished%100;
timeleft=(int) (seconds*1000+min);
if(millisUntilFinished>=10000)
{
changeText.setTextColor(Color.GREEN);
}
else if(millisUntilFinished>=5000)
{
changeText.setTextColor(Color.MAGENTA);
}
else
{
changeText.setTextColor(Color.RED);
}
changeText.setText(String.format("%02d", seconds)+ "."+String.format("%02d", min)+" sec");
}
public void onFinish() {
timeleft=0;
missed++;
nametext.setTextColor(Color.RED);
nametext.setText("Time Up!");
bottombutton.setVisibility(View.INVISIBLE);
globalflag=13;
changeText.setTextColor(Color.RED);
changeText.setText("0.00 Sec");
Handler myHandler = new Handler();
myHandler.postDelayed(mMyRunnablecif, 3000);
}
}.start();
cancel()을 호출했지만 잠시 동안 카운트를 멈추고 onFinish()를 호출합니다. 나는 cancel()을 호출 한 후에 onFinish()를 호출 할 필요가 없다. 어떤 도움을 주시면 감사하겠습니다.
합니까 onFinish을 () 그것이 속한 acivity를 회상합니까? 또는 전화 걸기 oncreate() – Moyeen
onFinish()와 관련하여 카운트 다운 타이머가 활동에 연결되어 있지 않습니다. 카운트 다운 타이머가 완료되면 호출되는 메서드입니다. – Tony