title: How to stop the animation when required and start it immediately in android
body: <p>I am new to android and I need help. </p>
  
  <p>I want my image which is falling from the top of screen to get invisible when I click a button on the keyboard which has the same tag as the image. Although I have implemented the above points a problem arises when I want to show the next animation again immediately after the previous image gets invisible. This is my code for animation. </p>
  
  <pre><code>public void startAnimation(final ImageView aniView) 
  {
  
      animator= ValueAnimator.ofFloat(0 ,.85f);
      animator.setDuration(Constants.ANIM_DURATION);
      animator.setInterpolator(null);
  
      //generation of random values
      Random rand = new Random();
      index = rand.nextInt((int) metrics.widthPixels);
      //for debugging
      i = Integer.toString(index);
      Log.e(" index is :", i);
      animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
      {       
  
  
  
  
          @Override
          public void onAnimationUpdate(ValueAnimator animation)
          {
              float value = ((Float) (animation.getAnimatedValue())).floatValue();
  
              aniView.setTranslationX(index);
  
              aniView.setTranslationY((height+ (50*mScale))*value);
              //aniView.setTranslationY(height);
          }
      });
      animator.start();
  }
  
  //keyboard methods goes here
  
  @Override
  public void onClick(View v)
  {
      gettext(v);
  }
  
  private void gettext(View v)
  {
      try
      {
          String b = "";
          b = (String) v.getTag();
  
          String img_val = map.get(b);
          int  imgid = (Integer) imageView.getTag();
  
          Log.e("img values=:", img_val+"  "+imgid);
          if(img_val.equals(ALPHABETS[imgid]))
          {
              imageView.setVisibility(View.INVISIBLE);
  
              animator.start();
              //trying to start the animation again 
          }   
  </code></pre>
  
  <p>I am using the animation.addupdateListener to call the animation again and again but it only calls when the <em>.ofFloat</em> finishes on the value. When I click on the appropriate button the animation gets invisible but the next animation starts again after the same time. I want to start it immediately.</p>