user7436941
user7436941

Reputation:

fragment to activity animation does not work with overridePendingTransition();

I want to switch the animation when I switch from a fragment to an activity but the function

overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up );

is red marked with Cannot resolve method in the fragment.

In activities it works fine. How can I make it work?

Upvotes: 5

Views: 2574

Answers (1)

AskNilesh
AskNilesh

Reputation: 69754

is red marked with Cannot resolve method overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up ); in the fragment.

Because overridePendingTransition(R.anim.slide_in_up, R.anim.slide_out_up ); method of Activity not of Fragment

Try this

  getActivity().overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );

Upvotes: 10

Related Questions