a guest Apr 22nd, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. if (event.sensor.getType() == Sensor.TYPE_STEP_COUNTER) {
  2.             // TYPE_STEP_COUNTER returns the total number of steps taken by the user since the last reboot (power on) of the phone.
  3.             if (initialCounterSteps < 1)
  4.                 initialCounterSteps = (int) event.values[0]; // gets steps to subtract
  5.             // Calculate steps taken since app was opened, paused, reset.
  6.             stepCounter = (int) event.values[0] - initialCounterSteps;
  7.             steps_count_tv.setText(String.valueOf(stepCounter));
  8.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand