error: cannot find symbol class ofArgb

585 views Asked by At

I'm trying to animate colors and I'm getting a strange error in Android Studio. My code:

import android.animation.ValueAnimator;

... later ...

ValueAnimator valueAnimator = new ValueAnimator.ofArgb(Color.YELLOW, Color.TRANSPARENT);

The following compilation error is thrown:

error: cannot find symbol class ofArgb

This seems to happen for other methods of ValueAnimator, like ofInt. It doesn't seem to happen for other Animators like ObjectAnimator.ofArgb which gives me a warning that it is SDK 21 and up.

1

There are 1 answers

0
Andrew Stromme On BEST ANSWER

new slipped in when it shouldn't have. Correct code:

ValueAnimator valueAnimator = ValueAnimator.ofArgb(Color.YELLOW, Color.TRANSPARENT);

Which correctly informs me that API 21 is required.

Thanks Mike M.