Android RotateAnimation compass rotation
<p>I have a custom built compass that is used as part of a navigation app that I have written. I have also written an algorithm that that smooths out the compass (a type of low-pass filter). Everything works great and the compass is fluid. I pass in a current degrees and previous degrees arguments to the RotateAnimation. Problem is when you spin around quickly with the compass, after a certain point, the gap is so large between the current and previous degrees that the rotate switches direction to the path of least distance. It has to do with the sort of lag that happens from the low-pass filter - that it has to catch up wit the real-time direction. I was wondering if anyone has dealt with this (I have seen some compass apps from the store that handle this) or has some kind of algorithm/solution, to keep the orientation of the rotation. Here is some code:</p>

<pre><code>RotateAnimation rotate = new RotateAnimation(startingPointer, pointerDeg, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
    rotate.setInterpolator(new LinearInterpolator());
    rotate.setDuration(ROTATION_INTERVAL);
    rotate.setFillAfter(true);
    pointer.setAnimation(rotate);
    startingPointer = pointerDeg;
</code></pre>
