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.


No comments:

Post a Comment


不是很好看。以為 Jake Gyllenhaal 有演出,應該會有點看頭的。 故事是在講一群太空人在太空站上試著培養火星來的休眠單細胞生物,最後愈搞愈大,變得不可收拾的地步。 中間很多故做緊張的情節,但因為張力不夠,再加上配樂又不是很優(也有可能是因為在家看的關係,聲光效...