Reputation: 6236
So I am trying to use ActivityOptionsCompat here
ActivityOptionsCompat options =
ActivityOptionsCompat.makeSceneTransitionAnimation(NoticeViewer.class,
v, // The view which starts the transition
transitionName // The transitionName of the view we’re transitioning to
);
The first argument is supposed to be an Activity object, which I'm trying to supply through the relevant class file, but I get the following type conversion error -
Error:(194, 54) error: no suitable method found for makeSceneTransitionAnimation(Class<NoticeViewer>,View,String)
method ActivityOptionsCompat.makeSceneTransitionAnimation(Activity,View,String) is not applicable
(actual argument Class<NoticeViewer> cannot be converted to Activity by method invocation conversion)
method ActivityOptionsCompat.makeSceneTransitionAnimation(Activity,Pair<View,String>...) is not applicable
(actual argument Class<NoticeViewer> cannot be converted to Activity by method invocation conversion)
I'm missing something really simple, but what is it?
Upvotes: 0
Views: 438
Reputation: 132982
Use NoticeViewer.this
instead of NoticeViewer.class
to pass current Activity Context as first parameter :
ActivityOptionsCompat.makeSceneTransitionAnimation(NoticeBoard.this,...)
Upvotes: 2