In my Android application, I apply programmatically a rotation animation to a drawable object :
Animation rotation = AnimationUtils.loadAnimation(this, R.animator.rotate);
rotation.setRepeatCount(Animation.INFINITE);
progressDialog.findViewById(R.id.progress).startAnimation(rotation);
This is working fine in Android 2.3, but fails in 4.0. The drawable is not animated in 4.0. What could be the problem here ?
EDIT
Here is my rotate.xml
file :
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<rotate
android:fromDegrees="0"
android:toDegrees="360"
android:pivotX="50%"
android:pivotY="50%"
android:duration="2000"
android:repeatCount="-1"
android:interpolator="@android:anim/linear_interpolator"/>
</set>
I moved the code just before the call of the show
method of the container view and it's working now, both in 2.3 and 4.0 :
Animation rotation = AnimationUtils.loadAnimation(MainView.this, R.animator.rotate);
progressDialog.findViewById(R.id.progress).startAnimation(rotation);
progressDialog.show();