Answer the question
In order to leave comments, you need to log in
Strangeness when calculating the number of minutes / seconds, why is that?
private void runTimer() {
final TextView timeView = (TextView)findViewById(R.id.time_view);
int hours = seconds/3600;
int minutes = (seconds%3600)/60;
int secs = seconds%60;
String time = String.format(Locale.getDefault(),
"%d:%02d:%02d", hours, minutes, secs);
timeView.setText(time);
if (running) {
seconds++;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question