카운트 다운을 업데이트하지 않는 countDownTimer를 사용하고 있습니다. 분과 시간을 카운트 다운하고 있습니다. 카운트 다운은 활동을 다시 시작할 때만 업데이트되었습니다. 틱을 업데이트하지 않습니다. 제발 도와주세요. 감사합니다. 내 코드는 다음과 같습니다.
Date eventStartDate = Utility.stringToDate(event.eventFrom);
Date currentDateTime = new Date();
long ms = eventStartDate.getTime() - currentDateTime.getTime();
long ms1 = eventStartDate.getTime() - currentDateTime.getTime();
if (ms > 0) {
long miliSecondsPerSecond = 1000;
long miliSecondsPerMinute = miliSecondsPerSecond * 60;
long miliSecondsPerHour = miliSecondsPerMinute * 60;
long miliSecondsPerDay = miliSecondsPerHour * 24;
long days = ms / miliSecondsPerDay;
ms = ms - (days * miliSecondsPerDay);
final long hours = ms / miliSecondsPerHour;
ms = ms - (hours * miliSecondsPerHour);
final long minutes = ms / miliSecondsPerMinute;
ms = ms - (minutes * miliSecondsPerMinute);
new CountDownTimer(ms1, miliSecondsPerMinute) { // adjust the milli seconds here
public void onTick(long millisUntilFinished) {
eventTimer.setText(hours + ":" + minutes);
}
public void onFinish() {
eventTimer.setText("00:00");
}
}.start();
OnTick 내부에 다음 코드 작성
Date eventStartDate = Utility.stringToDate(event.eventFrom);
Date currentDateTime = new Date();
long ms = eventStartDate.getTime() - currentDateTime.getTime();
long ms1 = eventStartDate.getTime() - currentDateTime.getTime();
if (ms > 0)
{
long miliSecondsPerSecond = 1000;
long miliSecondsPerMinute = miliSecondsPerSecond * 60;
long miliSecondsPerHour = miliSecondsPerMinute * 60;
long miliSecondsPerDay = miliSecondsPerHour * 24;
long days = ms / miliSecondsPerDay;
ms = ms - (days * miliSecondsPerDay);
final long hours = ms / miliSecondsPerHour;
ms = ms - (hours * miliSecondsPerHour);
final long minutes = ms / miliSecondsPerMinute;
ms = ms - (minutes * miliSecondsPerMinute);
}
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다