I saw many examples about filtering Accelermeter\'s values, to cancel out the gravity (High-pass filter).
But most of them were 1st order one, which is said to be simple
You want to utilize Android's SensorListener()
Class. For example, "The Schwartz Unsheathed" is open source Android project hosted on Google Code that looks like it should be quite useful (written by Clark Scheff).
You can check out its source via SVN http://code.google.com/p/the-schwartz-unsheathed/source/checkout or just browse it on the web. The source is broken up into an Activity (TheSchwartz.java) and a View (GraphView.java). GraphView.java contains SensorListener()
ad onSensorChanged()
classes which is where the accelerometer processing occurs. Lines 284 and 285:
magnitude = (float)Math.sqrt(values[0]*values[0]+values[1]*values[1]+values[2]*values[2]);
magnitude = Math.abs(magnitude - SensorManager.GRAVITY_EARTH);
The value of magnitude
is evaluated for no movement, a "hit" or a "swing" of the Android phone. I realize this does not filter the data in a signal processing sense, but it does show a way to classify sensor data. Hope it helps.