End animation event android
You can add Animation listener to your animation object like
anim.setAnimationListener(new Animation.AnimationListener(){
@Override
public void onAnimationStart(Animation arg0) {
}
@Override
public void onAnimationRepeat(Animation arg0) {
}
@Override
public void onAnimationEnd(Animation arg0) {
}
});
Functionally the same as the accepted answer but in a much more concise way:
// Add/Remove any animation parameter
theView.animate()
.alpha(0)
.setDuration(2000)
.withEndAction(new Runnable() {
@Override
public void run() {
theView.setVisibility(View.GONE);
}
});
Enjoy :)