I am using countdown timer to show the left time in text view.It is working fine. Below is the code:-\
public class MyCount extends CountDownTimer {
Context mContext;
public MyCount(long millisInFuture, long countDownInterval) {
super(millisInFuture, countDownInterval);
}
public void onTick (long millisUntilFinished) {
MainActivity.timeDisplay.setText(formatTime(millisUntilFinished));
}
public void onFinish() {
AutomaticCallRecorderStaticMethod.startRecording();
}
}
public String formatTime(long millis) {
output = "";
long seconds = millis / 1000;
long minutes = seconds / 60;
long hours=minutes/ 60;
seconds = seconds % 60;
minutes = minutes % 60;
hours=hours%60;
String secondsD = String.valueOf(seconds);
String minutesD = String.valueOf(minutes);
String hoursD=String.valueOf(hours);
if (seconds < 10)
secondsD = "0" + seconds;
if (minutes < 10)
minutesD = "0" + minutes;
if (hours < 10)
hoursD = "0" + hours;
output = hoursD+" : "+minutesD + " : " + secondsD;
return output;
}
Code to start the timer:-
counter = new MyCount (length, 10);
Everything is working fine. It shows the timer in text view like as 00:00:00 and the maximum limit is 59:59:59. It means only 60 hours. Now I want that the limit should be increased if the user select 3 days then the timer should start from 71:59:59 or something like that so that the finish() method of countdown timer should be called after 3 days.How can I do that?? Beside it I want to show number of days also in the below format:-
Days:Hours:minutes:seconds left .
How can I achieve that.Please help me to sort out this problem.