Set the interpolator for android animations in Java

ACarter picture ACarter · Feb 16, 2012 · Viewed 33.1k times · Source

This seems very simple: I'm trying to set the interpolator to be used for an animation in my App. I need to set this in the Java code, not the XML (It will change according to various things).

From the android website, I've found setInterpolator()

However, I'm not sure how to use this.

I've tried just feeding in the interpolar name (ie. BounceIterpolator), but this did nothing.

I tried R.anim.BounceIterpolator, but Intellisense said anim cannot be resolved or is not a field.

So how can I set the interpolator from the Java?

Answer

Reuben Scratton picture Reuben Scratton · Feb 16, 2012
setInterpolator(new BounceInterpolator());