Adam Katz Adam Katz - 1 year ago 86
Android Question

is there a TranslateAnimation onComplete?

I am animating a view to move off the screen, on complete i would like to call another function but I cant seem to find a onComplete method.

int originalPos[] = new int[2];
icons.getLocationOnScreen( originalPos );
layoutMoved = originalPos[0]+icons.getWidth();
TranslateAnimation anim = new TranslateAnimation( 0, -layoutMoved , 0, 0);
anim.setFillAfter( true );

Answer Source

Set an AnimationListener, you'll have access to OnAnimationEnd.

anim.setAnimationListener(new Animation.AnimationListener() {
    public void onAnimationStart(Animation animation) {


    public void onAnimationEnd(Animation animation) {
       // do your stuff

    public void onAnimationRepeat(Animation animation) {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download