How Can i get the Values of Rotation Vactor sensor in android
<p>my aim to calculate almost all sensor's values from android device.. i have done it except the rotation vector sensor.. but i also want to know the authenticity of my code.. is all values display correctly.. here is my code..</p>

<p>public void onSensorChanged(SensorEvent sensorEvent) {
        synchronized (this) {</p>

<pre><code>        if (sensorEvent.sensor.getType() == Sensor.TYPE_ACCELEROMETER) {

            long curTime = System.currentTimeMillis();
            if (lastUpdate == -1 || (curTime - lastUpdate) &gt; 500) {
                lastUpdate = curTime;

                gravity[0] = alpha * gravity[0] + (1 - alpha) * sensorEvent.values[0];
                gravity[1] = alpha * gravity[1] + (1 - alpha) * sensorEvent.values[1];
                gravity[2] = alpha * gravity[2] + (1 - alpha) * sensorEvent.values[2];

                linear_acceleration[0] = sensorEvent.values[0] - gravity[0];
                linear_acceleration[1] = sensorEvent.values[1] - gravity[1];
                linear_acceleration[2] = sensorEvent.values[2] - gravity[2];

                acceleration[0] = gravity[0] + linear_acceleration[0];
                acceleration[1] = gravity[1] + linear_acceleration[1];
                acceleration[2] = gravity[2] + linear_acceleration[2];

                AccX.setText( "TYPE_ACCELEROMETER Sensor Values \n " +
                              "X = "+Float.toString( sensorEvent.values[0])+"  m/s^2");
                AccY.setText( "Y = "+Float.toString( sensorEvent.values[1])+"  m/s^2");
                AccZ.setText( "Z = "+Float.toString( sensorEvent.values[2])+"  m/s^2 \n");


                GravX.setText( "TYPE_GRAVITY Sensor Values \n " +
                               "X = "+Float.toString(gravity[0])+"  m/s^2");
                GravY.setText( "Y = "+Float.toString(gravity[1])+"  m/s^2");
                GravZ.setText( "Z = "+Float.toString(gravity[2])+"  m/s^2\n");

                LAccX.setText( "TYPE_LINEAR_ACCELERATION Sensor Values \n" +
                               "X = "+Float.toString(linear_acceleration[0])+"  m/s^2");
                LAccY.setText( "Y = "+Float.toString(linear_acceleration[1])+"  m/s^2 ");
                LAccZ.setText( "Z = "+Float.toString(linear_acceleration[2])+"  m/s^2\n ");
            }
        }

        if (sensorEvent.sensor.getType() == Sensor.TYPE_ORIENTATION) {
            long curTime = System.currentTimeMillis();
            if (lastUpdate == -1 || (curTime - lastUpdate) &gt; 500) {
                lastUpdate = curTime;

                OriX.setText("TYPE_ORIENTATION Values \n " +
                             "X = "+Float.toString( sensorEvent.values[0])+"  degree");
                OriY.setText("Y = "+Float.toString( sensorEvent.values[1])+"  degree");
                OriZ.setText("Z = "+ Float.toString( sensorEvent.values[2])+"  degree \n");
            }
        }

        if (sensorEvent.sensor.getType() == Sensor.TYPE_MAGNETIC_FIELD) {
            long curTime = System.currentTimeMillis();
            if (lastUpdate == -1 || (curTime - lastUpdate) &gt; 500) {
                lastUpdate = curTime;

                magneticX.setText( "TYPE_MAGNETIC_FIELD Sensor Values \n " +
                                   "X = "+ Float.toString( sensorEvent.values[0])+"  micro-Tesla (uT) ");
                magneticY.setText( "Y = "+Float.toString( sensorEvent.values[1])+"  micro-Tesla (uT) ");
                magneticZ.setText( "Z = "+Float.toString( sensorEvent.values[2])+"  micro-Tesla (uT) \n");
            }
        }

        if (sensorEvent.sensor.getType() == Sensor.TYPE_GYROSCOPE) {
            long curTime = System.currentTimeMillis();
            if (lastUpdate == -1 || (curTime - lastUpdate) &gt; 500) {
                lastUpdate = curTime;
                GyrX.setText( "TYPE_GYROSCOPE Sensor Values \n X = "+ Float.toString( sensorEvent.values[0])+"  ");
                GyrY.setText( "Y = "+Float.toString( sensorEvent.values[1])+"  ");
                GyrZ.setText( "Z = "+Float.toString( sensorEvent.values[2])+"  ");
            }
        }


    }

}
</code></pre>

<p>and please let me know about how to display rotation vcctor sensor values.. </p>
