Created
March 21, 2012 23:19
-
-
Save iewnait/2154078 to your computer and use it in GitHub Desktop.
onSensorChanged() for MagnetometerDemo
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
public void onSensorChanged(SensorEvent event) { | |
switch (event.sensor.getType()) { | |
case Sensor.TYPE_ACCELEROMETER: | |
// We need both the acceleration and magnetometer data to determine | |
// compass rotation. Save these values. | |
mAccelerationVals = event.values.clone(); | |
break; | |
case Sensor.TYPE_MAGNETIC_FIELD: | |
// We need both the acceleration and magnetometer data to determine | |
// compass rotation. Save these values. | |
mMagneticFieldVals = event.values.clone(); | |
//more code here | |
break; | |
//more code here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment