3

I have a Chronometer and a int variable representing the accumulated minutes when it was stoped. I want to resume the chronometer from these minutes.

int accumulatedMinutes = 2;
chronometer.setBase(SystemClock.elapsedRealtime() + accumulatedMinutes*60000);

But, in the case above, instead of 02:00, I get 00:-120

Thanks.

Rami
  • 7,879
  • 12
  • 36
  • 66
Héctor
  • 24,444
  • 35
  • 132
  • 243

1 Answers1

2

Need Subtraction instead of Addition.

You should try with

chronometer.setBase(SystemClock.elapsedRealtime() - accumulatedMinutes*60000);
IntelliJ Amiya
  • 74,896
  • 15
  • 165
  • 198