turn the screen on/off in Android with a shake
问题 I'm making an app that needs to toggle the screen on/off when the user shakes the phone. So far, I've got a SensorEventListener that listens to the shakes as suggested in the answer to this question. When I detect a shake, I change the value of the screen's brightness as suggested in this question's answer. It all works great if I don't actually turn the screen off... if I set the brightness to 0.01f through the public void setBright(float value) method it works perfectly. However, if I set