Hi,

I'm trying to detect landscape vs portrait orientation with the
following:

  public void onSensorChanged(SensorEvent event) {
      float pitch = event.values[2];
      if (pitch <= 45 && pitch >= -45) {
         // portrait
      }
      else if (pitch < -45) {
         // landscape
      }
      else if (pitch > 45) {
         // landscape
      }
  }

anyone have something more robust? It works pretty well, except if the
phone is in a landscape orientation, and the user starts to 'flatten'
it out, starts thinking it's in the portrait orientation again,

Thanks

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to