开发者

Stopping a sensorListenser

I add 开发者_开发百科a sensorListener(code from to my app, the allow the user shake the phone in order to start the game.

How do I disable the sensor after the first shake?

I got the sensor code from here


The API indicates that there is an "unregister method": http://developer.android.com/reference/android/hardware/SensorManager.html#unregisterListener%28android.hardware.SensorEventListener,%20android.hardware.Sensor%29

After you have received your event you can use the Sensor Manager to unregister it - but your current code may use deprecated methods. You may want to have a look at this API to make sure it is up to date.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜