Android: how to use ValueAnimator

If you really, really, really want to use ValueAnimator for animating translation of the View you can do it this way (finishing your example, assuming you meant translationX; bare in mind that you’re animating translation from 0px to 3px, so you probably won’t see much difference):

public static void move(final TextView view){
    ValueAnimator va = ValueAnimator.ofFloat(0f, 3f);
    int mDuration = 3000; //in millis
    va.setDuration(mDuration);
    va.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            view.setTranslationX((float)animation.getAnimatedValue());
        }
    });
    va.setRepeatCount(5);
    va.start();
}

ValueAnimator is a great tool for making animations. Usually we have two steps:

Step 1- Create your ValueAnimator class by

ValueAnimator animator = ValueAnimator.ofFloat(start value, end value);

Step 2- Adding one update listener and overriding at least onAnimationUpdate() function

animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            float value = (float) animator.getAnimatedValue();

            //this value should be used to update properties of views.
            //just don't forget to run invalidate function of your views 
              // to redraw them. 
        }
    });