Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (event.sensor.getType() == Sensor.TYPE_STEP_COUNTER) {
- // TYPE_STEP_COUNTER returns the total number of steps taken by the user since the last reboot (power on) of the phone.
- if (initialCounterSteps < 1)
- initialCounterSteps = (int) event.values[0]; // gets steps to subtract
- // Calculate steps taken since app was opened, paused, reset.
- stepCounter = (int) event.values[0] - initialCounterSteps;
- steps_count_tv.setText(String.valueOf(stepCounter));
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement