Code example for Animator

Methods: cancel

0
        circlePaintAnimator.setRepeatMode(ValueAnimator.REVERSE);
        circlePaintAnimator.addListener(new AnimatorListenerAdapter() {
            @Override 
            public void onAnimationRepeat(Animator animation) {
                if (getText() == "-" && circlePaint.getAlpha() == 0) {
                    animation.cancel();
                } 
            } 
        }); 
        circlePaintAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
            @Override 
            public void onAnimationUpdate(ValueAnimator animation) {
                invalidate();
            } 
        }); 
    } 
     
    private Paint initCirclePaint() {
        Paint p = new Paint(Paint.ANTI_ALIAS_FLAG);
        p.setColor(Color.RED);
        p.setAlpha(0);