Reputation: 4314
I'm using this class for shaking event :
http://android.hlidskialf.com/blog/code/android-shake-detection-listener
What I want is: if user shake the device for 3 seconds in a row, than do something :
mShaker = new ShakeListener(this);
mShaker.setOnShakeListener(new ShakeListener.OnShakeListener () {
public void onShake()
{
Log.e("test", "shaking");
}
});
thanks in advance :)
Upvotes: 0
Views: 209
Reputation: 44834
have a look at this link
http://lfhck.com/question/303373/android-shake-detector-too-sensitive
it is using a SensorEventListener
and the onSensorChanged
event.
Upvotes: 1