title: How to calculate Foot step using Pedometer
body: <p>i develop application for calculation of  calories burn by walking for that i use SensorEventListener  <strong>(ACCELEROMETER)</strong>  i get three value from that X,Y,Z.
  my question is how to calculate foot step using that three X,Y,Z.
  this is my code for getting X,Y,Z value. i use GPS also. but <strong>i required count step using Pedometer in Android</strong> guyzz PLZ help me.</p>
  
  <pre><code>package com.mxicoders.prashant;
  
  import android.app.ActivityGroup;
  import android.content.Intent;
  import android.hardware.Sensor;
  import android.hardware.SensorEvent;
  import android.hardware.SensorEventListener;
  import android.hardware.SensorManager;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Chronometer;
  import android.widget.ImageButton;
  import android.widget.TextView;
  import android.widget.Toast;
  
  public class MyWorkout extends ActivityGroup implements SensorEventListener {
  
      ImageButton btnfacebook, btnstartwalk, btnstopwalk;
      Chronometer mchoronometer;
      Intent getintent;
      String _getname, _getage, _gethight, _getwidth;
      TextView txtx, txty, txtz;
      private SensorManager sensorManager;
  
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.my_workout);
  
          txtx = (TextView) findViewById(R.id.txtview_steps_myworkout);
          txty = (TextView) findViewById(R.id.txtview_distance_myworkout);
          txtz = (TextView) findViewById(R.id.txtview_calary_myworkout);
          btnfacebook = (ImageButton) findViewById(R.id.imgview_facebook_myworkout);
  
          btnfacebook.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  // TODO Auto-generated method stub
                  Intent inn = new Intent(getParent(), MyworkoutFacbook.class);
                  WorkoutTabGroupActivity parantActivity = (WorkoutTabGroupActivity) getParent();
                  parantActivity.startChildActivity("MyworkoutFacbook", inn);
  
              }
          });
          btnstartwalk = (ImageButton) findViewById(R.id.imgbtn_start_myworkout);
          btnstartwalk.setOnClickListener(new OnClickListener() {
  
              public void onClick(View arg0) {
                  // TODO Auto-generated method stub
  
                  sensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);
  
                  sensorManager.registerListener(MyWorkout.this, sensorManager
                          .getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
                          SensorManager.SENSOR_DELAY_NORMAL);
                  Toast.makeText(getApplicationContext(), "Start",
                          Toast.LENGTH_LONG).show();
  
  
              }
          });
  
          btnstopwalk = (ImageButton) findViewById(R.id.imgbtn_stop_myworkout);
          btnstopwalk.setOnClickListener(new OnClickListener() {
  
              public void onClick(View v) {
                  // TODO Auto-generated method stub
  
  
              }
          });
  
      }
  
      public void onAccuracyChanged(Sensor sensor, int accuracy) {
          // TODO Auto-generated method stub
  
      }
  
      public void onSensorChanged(SensorEvent event) {
          // TODO Auto-generated method stub
          if (event.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {
              float x = event.values[0];
              float y = event.values[1];
              float z = event.values[2];
              txtx.setText("X: " + x);
              txty.setText("X: " + y);
              txtz.setText("X: " + z);
          }
  
      }
  }
  </code></pre>