Disable UI in my Activity when user places the phone near his/her ear?
<p>How can I disable my UI of my activity when user place the phone near his/her ear?</p>

<p>I know there is an API which get a call back when there is a sensor to test for Proximity:</p>

<p><a href="http://developer.android.com/reference/android/hardware/Sensor.html" rel="nofollow">http://developer.android.com/reference/android/hardware/Sensor.html</a></p>

<p><a href="http://developer.android.com/reference/android/hardware/SensorManager.html" rel="nofollow">http://developer.android.com/reference/android/hardware/SensorManager.html</a></p>

<p>But how can I disable UI (like user's face won't mistakenly as UI touching) and then re-enable back when the phone is further away from User's face?</p>

<p>Thank you.</p>
