Hello all, I'm using a HTC Magic in order to develop an application which makes use of the accelerometer. Following the indications from tutorials and the docs, this is a snapshot of the code I'm using:
/* Next code register the ACCELEROMETER SENSOR*/ SensorManager mSensorManager = (SensorManager) getSystemService (Context.SENSOR_SERVICE); List<Sensor> listSensors = mSensorManager.getSensorList (Sensor.TYPE_ACCELEROMETER); Sensor acelerometerSensor = listSensors.get(0); mSensorManager.registerListener(this, acelerometerSensor, SensorManager.SENSOR_DELAY_UI); /*OnSensorChanged Method, here I receive the wrong values*/ public void onSensorChanged(SensorEvent event) { // TODO Auto-generated method stub synchronized (this) { switch(event.sensor.getType()) { case Sensor.TYPE_ACCELEROMETER: for (int i=0 ; i<3 ; i++) { mAccelerometerValues[i] = event.values[i]; } if ( mAccelerometerValues[0] >= 1) //selectAndChange() send some HTTP Petitions and updates the screen selectAndChange(0, null,"",3); else if ( mAccelerometerValues[0] <= -1) [...] default: } } } I'm nevermind getting values that don't match with the accelerometer. With the phone standing over my table, with no movement, I get values like: [0,0,15] [0,6,8] [0,0,0] And sometimes the expected value: [0,9.8,0] I guess my SensorManager is kind of mixing all the other sensors, but I do not guess where the problem could be. I have been checking other codes, and in all of them the estructure is aproximately the same. Any clues of what could I try? Thank you -- You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en