Basically, I have a count down timer right? And I need to display the time left for the timer in text. I have done that, but the timer's time is a bit off, as it needs to convert the seconds left into hours and minutes, like on a regular digital watch where it says 00:05:00 and it counts down to 00:04:59. I've done a lot of things today and my head is hurting quite a bit at the moment, so I can't exactly think about it. So my guess is that I need to use multiples of 60. Help?
Code:
int timeinminutes=1;
new CountDownTimer(timeinminutes*100000, 1000) {
TextView mTextField = (TextView) findViewById(R.id.textView1);
public void onTick(long millisUntilFinished) {
long hrs=0;
long mnts=0;
long scnds=0;
scnds=(millisUntilFinished/1000);
if (scnds>59) {
mnts=(scnds/60);
if (mnts!=Math.floor(mnts)) {
mnts=0;
}
}
if (mnts>59) {
hrs=(mnts/60);
if (hrs!=Math.floor(hrs)) {
hrs=0;
}
}
mTextField.setText(hrs + ":" + mnts + ":" + scnds);
}
public void onFinish() {
mTextField.setText("00:00:00");
}
}.start();