I\'m new here and new to Android Development, I Have a question regarding the Android CountDownTimer. How am I able to use Android\'s CountDownTimer, to count down to a specific
Helpful method !
@Override
public void start(final long miliSecond, final int interval) {
new CountDownTimer(miliSecond, interval) {
@Override
public void onTick(long millisUntilFinished) {
long day = TimeUnit.MILLISECONDS.toDays(millisUntilFinished);
millisUntilFinished -= TimeUnit.DAYS.toMillis(day);
long hour = TimeUnit.MILLISECONDS.toHours(millisUntilFinished);
millisUntilFinished -= TimeUnit.HOURS.toMillis(hour);
long minute = TimeUnit.MILLISECONDS.toMinutes(millisUntilFinished);
millisUntilFinished -= TimeUnit.MINUTES.toMillis(minute);
long second = TimeUnit.MILLISECONDS.toSeconds(millisUntilFinished);
intDay.setText("" + day);
intHour.setText("" + hour);
intMinute.setText("" + minute);
intSecond.setText("" + second);
}
@Override
public void onFinish() {
// What ever you want !
}
}.start();
}