为什么我不能使用 Sensor.TYPE_ORIENTATION_VECTOR。类型无法识别
问题是,此传感器应该可用:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GRAVITY
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int *TYPE_LINEAR_ACCELERATION*
- int TYPE_MAGNETIC_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_ROTATION_VECTOR
- int TYPE_TEMPERATURE
为什么这三个被禁用?它们无法识别...“TYPE_ROTATION_VECTOR 无法解析或不是字段”
仅识别这些:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int TYPE_MAGNETIC_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_TEMPERATURE
代码是:
mRotationVectorSensor = mSensorManager.getDefaultSensor(
Sensor.TYPE_ROTATION_VECTOR);
项目构建目标是 2.2,API 8。 为什么我不能使用 TYPE_ROTATION_VECTOR 和其他类型?
Tnx 回答!
The problem is, that this sensors should be available:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GRAVITY
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int *TYPE_LINEAR_ACCELERATION*
- int TYPE_MAGNETIC_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_ROTATION_VECTOR
- int TYPE_TEMPERATURE
Why are these three disabled? They are not recognised..."TYPE_ROTATION_VECTOR cannot be resolved or is not a field"
Only these are recognised:
- int TYPE_ACCELEROMETER
- int TYPE_ALL
- int TYPE_GYROSCOPE
- int TYPE_LIGHT
- int TYPE_MAGNETIC_FIELD
- int TYPE_ORIENTATION
- int TYPE_PRESSURE
- int TYPE_PROXIMITY
- int TYPE_TEMPERATURE
code is:
mRotationVectorSensor = mSensorManager.getDefaultSensor(
Sensor.TYPE_ROTATION_VECTOR);
Project build target is 2.2, API 8.
Why i can not use TYPE_ROTATION_VECTOR and other types?
Tnx for andswer!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您正在尝试访问仅适用于 API 版本 9 的传感器(您正在使用 API 版本 8)。
http://developer.android.com/reference/android/hardware/Sensor .html#TYPE_ROTATION_VECTOR
检查每个方法/字段右侧的“自 API 级别...”
You are trying to access a sensor that is available only from API version 9 (you are using API version 8).
http://developer.android.com/reference/android/hardware/Sensor.html#TYPE_ROTATION_VECTOR
Check the "Since API level ..." at the right of each method/field
在 Android 2.2 中,重力和线性加速度矢量不可用...
仅适用于版本 2.3 (GingerBread) 和更新版本...
问候拉尔夫
in Android 2.2, Gravity and linear Acceleration Vectors are not available...
Only for versions 2.3 (GingerBread) and newer...
Greetings Ralf