title: Start new activity using onShake method
body: <p>I'd like to start new activity by using onShake method. Everything is ok but when new activity starts, onShake command is still possible (when i shake my phone 5 times, new activity starts 5 times). What should I do to shake phone and start new activity only once?
  Here is my code.</p>
  
  <pre><code>public class ACTIVITY extends Activity {
  /** Called when the activity is first created. */
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      SensorManager mSensorManager;
  
      ShakeEvent mSensorListener;
  
      mSensorListener = new ShakeEvent();
      mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
      mSensorManager.registerListener(mSensorListener,
          mSensorManager.getDefaultSensor(Sensor.TYPE_ACCELEROMETER),
          SensorManager.SENSOR_DELAY_UI);
  
  
      mSensorListener.setOnShakeListener(new ShakeEvent.OnShakeListener() {
  
        public void onShake() {
            Intent i = new Intent(Shake.this, NEWACTIVITY.class);
            startActivity(i);
        }
      });
  }}
  </code></pre>
  
  <p>Excuse me for my bad English. Thank you for help.</p>