I'm rotating an ImageView
called photo
with this code:
RotateAnimation rotate = new RotateAnimation(fromDegrees, toDegrees, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
rotate.setDuration(400);
rotate.setFillEnabled(true);
rotate.setFillAfter(true);
rotate.setInterpolator(new LinearInterpolator());
rotate.setAnimationListener(new Animation.AnimationListener() {
});
photo.startAnimation(rotate);
It rotates nicely and persists. Later I might want to change the picture in this ImageView. However, my new image appears rotated because of the persisted animation on the previous one. How can I "undo" this animation before switching images?