Can someone provide an example as to how to use the proximity sensor? Please describe some event and how to use them.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
Every android mobile is shipped with sensors to measure various environmental conditions.Proximity sensor measures the distance that some object is from the device. It is often used to detect the presence of a person’s face next to the device.
Some proximity sensors only support a binary near or far measurement. In this case, the sensor should report its maximum range value in the far state and a lesser value in the near state.
The layout xml for the above code is given below:
In the above example we have 3 textview's. The first one is to display if the device supports proximity sensor, the second to display the maximum range supported by the sensor and the third one to display the current reading.
Hope this has given you a basic idea about proximity sensors.