Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save nesterchung/0ae102c5ef19fb75fa7967c56dcccb46 to your computer and use it in GitHub Desktop.
Save nesterchung/0ae102c5ef19fb75fa7967c56dcccb46 to your computer and use it in GitHub Desktop.
CountDownTimer with progressBar
CountDownTimer countDownTimer = new CountDownTimer(TIME_MILLIS, 100) {
@Override
public void onTick(long millisUntilFinished) {
double i = (1 - millisUntilFinished / (double) TIME_MILLIS) * 100;
progressBar.setProgress((int) i);
}
@Override
public void onFinish() {
progressBar.setProgress(100);
}
};
countDownTimer.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment