开发者

Angle of mobile while using

I'm working on an Android program for my research.

It needs to find out the angle while user using my mobile phone.

The angle here is like a rotation angle of entire mobile phone, not the widgets in layout.


I've tried keyword "angle" on http://developer.android.com/reference/packages.html

And I found a method "onSen开发者_StackOverflowsorChanged" under public interface SensorListener

But the description there is too hard to me to understand :Q

Is it the function I want?


Essentially you would do some inverse trig on the readings of the three accelerometers, to figure out the angle of "gravity" from its vector components in the three measured axis.

See ApiDemos in the sample applications package of the SDK, particularly Sensors.java

http://developer.android.com/resources/samples/get.html

You may just want to build that demo application, install it, and experiment with the screen showing the accelerometer data, then extract that part into a separate project and modify it towards your needs.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜