Victor Boutte' Victor Boutte' - 1 month ago 16
Android Question

Expected resource type of anim

.setCustomAnimations(R.animator.in_animation, R.animator.out_animation)
the following throws "Expected respource type of anim"

getSupportFragmentManager()
.beginTransaction()
.setCustomAnimations(R.animator.in_animation, R.animator.out_animation)
.replace(R.id.a_fragment, SingleAnswerFragment.newInstance())
.addToBackStack(null)
.commit();


I did check this stack over flow thread Android Studio's "expected resource of type" checks? and I did see where in this case I might use @Animator Res annotation, but i'm not sure how I would use that in the middle of my method chaining as shown above

http://stackoverflow.com/a/18511350/5596604 Here I see a possible solution but have no idea what he means in his steps where he, (Imported the NineOldAndroids library into the support-v4 Library
Imported the support-v4-nineoldandroids library into my project.) The github link for that support library for NineOldAndroids, states in the configuration part " remove Google's support v4 library from your classpath."

Answer

You are providing R.animator resources (@AnimatorRes) to the setCustomAnimations() method but it expects R.anim resource type (@AnimRes). If you switch to some animations which are referenced by R.anim it should compile and work.

but i'm not sure how I would use that in the middle of my method chaining as shown above

I'm not sure what you mean by this. Maybe this could shed some light on the matter. Also here you can find a list of all the Android annotations with short descriptions.