I am trying to calculate the pace value in my app. For that the formula I am using is
pace = time / distance traveled.
When a button is clicked I start calculating the distance I am traveling, but I don’t know how to get the time in minutes, exactly from when the button was clicked.
Please help me friends…..
Get the current time in milliseconds with
System.currentTimeMillis();Then you can convert it pretty much any time base you want. You’ll need a base from the moment your activity was started. Storing theSystem.currentTimeMillis();at the beginning of the activity and doing simple subtraction would work.