How to check to see if animation is running before starting new animation?

I'm assuming both fadeout and fadein are Animation objects.

Use fadeout.hasEnded() to check if the first has finished before starting your second one.

For more details about the Animation class, see here: http://developer.android.com/reference/android/view/animation/Animation.html


Instead of having to loop possibly in another thread checking if an animation has ended, you could use an animation listener, doing something like this:

// Create Animation
protected void fadeAnimation() {
   fadeout.setAnimationListener(new Animation.AnimationListener(){
         @Override
         public void onAnimationStart(Animation animation) {

         }
         @Override
         public void onAnimationEnd(Animation animation) {
              tempImg.startAnimation(fadein);
         }             
         @Override
         public void onAnimationRepeat(Animation animation) {

         }

   };
   tempImg.startAnimation(fadeout);

}

With this kind of solution you wouldn't need to be actively checking if an animation has finished and time it with the duration of the previous animation.

The onAnimationEnd(Animation) is fired right after the animation has ended. This also solves the issue of users with developer options "on" and animation speed set to "off".