I testing the accelerometer output on 2 different devices(Elocity A7 and Archos 7 Home tablet) but the sensor seems to be giving different results. I have it programmed to s
just wanted to add something to Hartok's answer as I couldn't understand it at first...
I've rewritten the method to be:
public static float[] adjustAccelOrientation(int displayRotation, float[] eventValues)
{
float[] adjustedValues = new float[3];
final int axisSwap[][] = {
{ 1, -1, 0, 1 }, // ROTATION_0
{-1, -1, 1, 0 }, // ROTATION_90
{-1, 1, 0, 1 }, // ROTATION_180
{ 1, 1, 1, 0 } }; // ROTATION_270
final int[] as = axisSwap[displayRotation];
adjustedValues[0] = (float)as[0] * eventValues[ as[2] ];
adjustedValues[1] = (float)as[1] * eventValues[ as[3] ];
adjustedValues[2] = eventValues[2];
return adjustedValues;
}
Exactly the same thing, just with more user friendly variable names and I recreate the float internally because I needed it like that... Simply call this function, put in the getRotation and the event.values float array, check the values of its return float array and pick whatever number you prefer...
Hope this helps someone!