当我调用mDisplay.getOrientation时,我收到了ORIENTATION_UNDEFINED

时间:2013-01-19 15:41:10

标签: android configuration

我想检索我的设备方向,当我调用mDisplay.getOrientation时,我收到了ORIENTATION,在这种情况下如何获得方向?

1 个答案:

答案 0 :(得分:1)

根据以下文档,方法getOrientation已被弃用。

http://developer.android.com/reference/android/view/Display.html#getOrientation()

尝试使用http://developer.android.com/reference/android/view/Display.html#getRotation(),这应该返回设备旋转的角度。