title: How to limit value orientation in rank Android
body: <p>How to limit value orientation in rank </p>
  
  <p>from
   <a href="http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation%28float%5B%5D,%20float%5B%5D%29" rel="nofollow">http://developer.android.com/reference/android/hardware/SensorManager.html#getOrientation%28float%5B%5D,%20float%5B%5D%29</a></p>
  
  <pre><code>values[0]: azimuth, rotation around the Z axis.
  values[1]: pitch, rotation around the X axis. Default (-180to180)
  values[2]: roll, rotation around the Y axis.  Default (-90to90)
  </code></pre>
  
  <p>I want to limit values[1] from default to (-90to90). How to do?</p>
  
  <pre><code>public void onSensorChanged(SensorEvent event) {
    // TODO Auto-generated method stub
    synchronized (this) {
  
      switch(event.sensor.getType()){
        case Sensor.TYPE_ORIENTATION: {
        com.app.labylinthii.Global.setXaxis(Float.toString(event.values[0]));
        com.app.labylinthii.Global.setYaxis(Float.toString(event.values[1]));
        com.app.labylinthii.Global.setZaxis(Float.toString(event.values[2]));
        break;
        }
        case Sensor.TYPE_ACCELEROMETER: {
          break;
        }
      }
    }
  </code></pre>
  
  <p>Thank You.</p>