开发者

how to find out in which direction was the phone tilted in android

i am making an Android application in which i need to find out in which direction the user is shaking is phone. Not tilting, i mean literally jerking his hand in the direction of.

Actually i am making a photo viewing application and i wish to know if he has jerked his phone to the开发者_高级运维 right then the next image should load up and if it is left movement , then the previous image should load up.

how do i achieve this. Currently to detect a shake i am using this tutorial.

thank you in advance.


Check out this article. I have not tried it personally but looks good to me.

http://www.codeshogun.com/blog/2009/04/17/how-to-detect-shake-motion-in-android-part-i/

You could adapt the motion detection calculation to actually determine the direction quite easily.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜