How to know if a TextView is in animation or not?

Mal*_*nta 5 android textview

upon onClickListener, I am starting an animation on textView (icon)

Animation anim = AnimationUtils
          .loadAnimation(activity.getBaseContext(), R.anim.rotate_refresh);
icon.startAnimation(anim);
Run Code Online (Sandbox Code Playgroud)

on clicking again, I want to check, if the icon is animating (rotating) , keep it that way or else start the animation again.

I want to know how can I check textview is in animation?

Mik*_*ael 7

Maybe try something like this

Animation animation = icon.getAnimation();
if(animation != null && animation.hasStarted() && !animation.hasEnded()){
    //do what you need to do if animating
}
else{
    //start animation again
}
Run Code Online (Sandbox Code Playgroud)


Aru*_*run 5

This line will let you know if the TextView is animated

Animation animation=textView.getAnimation();
Run Code Online (Sandbox Code Playgroud)