views:

20

answers:

1

Is there another way than doing our own counter to know how many times an animation has been repeated? (to produce different effects depending on the times it has been repeated.)

A: 

If you're having your Animation in yourAnim.setRepeatMode(Animation.RESTART); (RESTART-mode) then you can set a repeat counter to the animation or the animation set.

yourAnim.setRepeatCount(Animation.INFINITE);
yourView.startAnimation(yourAnim);

When you set your repeat count, you can control the number of times the animation will repeat. Above we have set the repeat counter to indefinitely.

Julian Assange
I don't want to set a number of repetition. Maybe I didn't explain correctly. I want to know, at a certain time, how many times an animation has been repeated.
Sephy
Ah, I understand now. Then you have to do your own counter and put it inside the an onCompletion-listener to keep track of how many times. You maybe have to do like this; but I can be wrong.
Julian Assange