• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

To count footstep added at a time interval

123456.PNG




Here is part of code, i wish to calculate number of step added for every 15 minutes no matter the sensor detect motion or not, and save it in 'numStepsAdd' and diaplay it. Then, update the latest number of steps into 'numStepsA' 1 minutes after displaying the 'numStepsAdd', so that i can use the formulae
'numStepsAdd=numSteps-numStepsA' to calculate numStepsAdd every 15 minutes. Then, repeat whole process for every 15 minutes.

But after i build my app, it will only show step added after every 15 minutes if the sensor detect steps, if the sensor does not detect any steps, the app will not show any changes in the 'numStepsAdd' until sensor detect steps is made.
But what i want is to show the number of steps added every 15 minutes no matter sensor detect steps or not. For example if there are 5 steps added, 'numStepsAdd' show 5, when there are no steps added, 'numStepsAdd' show 0, for every 15 minutes.

So, can sir tell me what is wrong in my code, and help me to do some correction on my code.
 
Back
Top Bottom