OrientationEventListener on Android to get current rotation degree

(Central Park.New York)

Strangely, it's not possible to get current rotation angle in android directly, except for getting the fixed 4 rotation modes: 0, 90, 180, 270. In order to get precise rotation degrees instead of rotation modes, OrientationEventListener can be used. Once it's implemented, you can get the rotation degree in onOrientationChanged(). It's a lot easier than manipulating values from all the sensors like gyroscope, accelerator, etc.

REF:





Comments

Popular posts from this blog

豈止於大 -- SONY DPT-S1 不專業開箱和心得分享

Adding macros in Android Studio (Intellij) -- take Adding Javadoc comment for example

如何批次下載教育廣播電台的教學節目有聲資料