【发布时间】:2014-08-14 08:35:28
【问题描述】:
我想像以下代码一样获取 android 的加速度计(x y z 坐标):
http://www.techrepublic.com/blog/software-engineer/a-quick-tutorial-on-coding-androids-accelerometer/ (函数:onSensorChanged(SensorEvent事件))
但我无法从代码中捕获事件,因为我不在活动类中。
有没有人知道如何在不访问事件的情况下访问此信息?
【问题讨论】:
-
具有组合到 Context 对象的常规类。我将 Context 对象作为参数。
标签: android android-activity accelerometer android-sensors android-event