Search code examples
androidanimationtween

passing null to setInterpolator crashes


I'm using TranslateAnimation object to animate my view. But it has a default ease-in & ease-out effect. I want no effects. Passing null to setInterpolator() method is making my application crash. What should i pass as an argument so that there are no effects? Or is there any other way to do it?


Solution

  • Do not pass null to setInterPolator. The default ('no effects') is a LinearInterpolator, which has a constant rate of change.

    Docs:

    public void setInterpolator (Interpolator i)

    Sets the acceleration curve for this animation.
    Defaults to a linear interpolation.