title: unregisterListener is not working on button click event
body: <p>Here is my code. I am new to android development. I called <code>registerListener</code> on button click event. It starts getting data from accelerometer but when I call <code>unregisterListener</code> from another button click, it is not working.</p>
  
  <pre><code>public void startButton(View view){
      findViewById(R.id.stop).setEnabled(true);
      findViewById(R.id.start).setEnabled(false);
      Intent intent = getIntent();
      selsensors = intent.getStringExtra(SensorsList.SELECTED_SENSORS);
      mSensorManager = (SensorManager)getSystemService(SENSOR_SERVICE);
      senList = mSensorManager.getSensorList(Sensor.TYPE_ALL);
      mAccelerometer = mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER);
      mSensorManager.registerListener(this, mAccelerometer,    mSensorManager.SENSOR_DELAY_NORMAL);
  }
  @Override
  public void onSensorChanged(SensorEvent event){
      if(event.sensor.getType()==Sensor.TYPE_ACCELEROMETER){
          ax = event.values[0];
          ay = event.values[1];
          az = event.values[2];
          Toast.makeText(this, "X: "+ax+"\nY: "+ay+"\nZ: "+az, Toast.LENGTH_SHORT).show();
      }
  }
  public void stopButton(View view){
      mSensorManager.unregisterListener(this);
      this.finish();
  }
  </code></pre>