Android View Rotation Animation and Set Rotation not working as intended
<p>I am trying to rotate a view 90 degrees, but every time this method is called the view instead jumps forward 90 degrees, then rotates an additional 90 degrees.</p>

<p>I've tried playing with the numbers without success. There seems to be something about how this code works that I do not understand.</p>

<p>Can someone please explain what's currently happening, and what needs to change to get the intended result?</p>

<pre><code>public void RotatePoint(float toDegrees) {
    final RotateAnimation rotate =
        new RotateAnimation(pt.getRotation(), pt.getRotation() + toDegrees,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f,
            RotateAnimation.RELATIVE_TO_SELF, 0.5f);
    rotate.setDuration(1000);
    rotate.setFillEnabled(true);
    rotate.setFillAfter(true);
    pt.startAnimation(rotate);
    pt.setRotation(pt.getRotation()+toDegrees);
    if (pt.getRotation() == 360) {
        pt.setRotation(0);
    }
}
</code></pre>