Pergunta

I've scrounged the web in search of a good example or someone trying to attempt the same thing, but so far I haven't had much luck.

I am trying to get my Devices rotation angle (If you can imagine) starting at 180° (Flat).

As the user tilts the device left and right, the angle adjusts accordingly. And as it rotates I want to simply update a TextView.

I'm just lost as to what this evolves, some people suggest a gyroscope, accelerometer, even a magnometer, or a combination. I've gotten a few different sensors to work, but none of the examples I've followed accomplish what I want to achieve.

I don't want anything to do with 3D, just a plan rotation.

Can anybody forward me in the right director, or provide some information?

Thank you very much!

Foi útil?

Solução

You implement OrientationEventListener this will give you the device rotation. Portrait is 0 degree.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top