ImageView rotating continuously
<p>I've used an ImageView in my compass app which rotates when sensor value changes. The problem is when device reaches between 173 to 186 degree angle my ImageView start rotating continuously from 0-360 degree angle. This particular problem started after I added a piece of code to decrease rotation speed of ImageView before this app was running perfectly fine.</p>

<p>A method added to decrease rotation speed</p>

<pre><code>protected float[] lowPass( float[] input, float[] output ) {
    if ( output == null ) return input;

    for ( int i=0; i&lt;input.length; i++ ) {
        output[i] = output[i] + ALPHA * (input[i] - output[i]);
    }
    return output;
}
</code></pre>

<p>Sensor Event Listener from where the method is called</p>

<pre><code>private SensorEventListener mySensorEventListener = new SensorEventListener() {
.
.
.
public void onSensorChanged(SensorEvent event) {
.
.
.
SensorManager.getOrientation(rotationMatrix, orientationValues);

    accelVals = lowPass( orientationValues, accelVals );

    azimuth = (int) Math.toDegrees(accelVals[0]);
    azimuth = (azimuth +360)%360;
    allowRotating=true;
    dialer.post(new RotateRunnable(azimuth));
.
.
.
}
};
</code></pre>

<p>Will be glad If any one can help me out</p>
