i have created a SLIDE UP animation on view and i am repeating this animation again onAnimationEnd but my onAnimationEnd fired twice , i have checked it with counter at onAnimationEnd , i will post my code, you can check that the counter in onAnimationEnd will incremented twice at same time , I am starting the animation again in onAnimationEnd method , please guide me where i am doing wrong?
private Animation animSlideUp;
animSlideUp = AnimationUtils.loadAnimation(getActivity(), R.anim.slide_up);
// set animation listener
animSlideUp.setAnimationListener(this);
animSlideUp.setDuration(500);
animSlideUp.setStartOffset(5000);
tickerView.startAnimation(animSlideUp);
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (animation == animSlideUp) {
ticker_counter++;
Log.e("onAnimationEnd=", "ticker_counter="+ticker_counter);
tickerView.startAnimation(animSlideUp);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
slide_up.xml
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true" >
<scale
android:duration="500"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:interpolator="@android:anim/linear_interpolator"
android:toXScale="1.0"
android:toYScale="0.0"/>
</set>
LOGCAT
11-19 17:06:54.375 E/onAnimationEnd=﹕ ticker_counter=1
11-19 17:06:54.392 E/onAnimationEnd=﹕ ticker_counter=2
11-19 17:06:59.912 E/onAnimationEnd=﹕ ticker_counter=3
11-19 17:06:59.928 E/onAnimationEnd=﹕ ticker_counter=4
11-19 17:07:05.453 E/onAnimationEnd=﹕ ticker_counter=5
11-19 17:07:05.470 E/onAnimationEnd=﹕ ticker_counter=6
11-19 17:07:10.991 E/onAnimationEnd=﹕ ticker_counter=7
11-19 17:07:11.008 E/onAnimationEnd=﹕ ticker_counter=8