android - Cancel animation, stop applyTransformation running -


i've created extension animation class in order create background fade out animation. start animation after pressing listview row item. if press 1 after want cancel first animation , start second. bug i'm having when press fast 1 row after animation doesn't stop. after debugging i've noticed applytransformation method keeps running first animation. i've decided override cancel function, how stop transformation?

public backgroundanimation(view view, int color){     this.view = view;     setduration(4000l);      red = color.red(color);     blue = color.blue(color);     green = color.green(color); } @override public void applytransformation(float interpolatedtime,transformation t){     //super.applytransformation(interpolatedtime, t);      view.setbackgroundcolor(color.argb((int) ((1 - interpolatedtime) * 255), red, green, blue));  } 

i had exact same problem, interpolatedtime run 0 -> 1 infinitely repeat 0. solution clearanimation in animationlistener. doesn't seem should have this, oh well.

animation.setanimationlistener(new animation.animationlistener() {     @override     public void onanimationstart(animation animation) {}      @override     public void onanimationend(animation animation) {         animationtarget.clearanimation();     }      @override     public void onanimationrepeat(animation animation) {} }); 

Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -