Question

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 :)

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top