Why overridePendingTransition does not take effect when I jump from Fragment to a new Activity?

Viewed 10587

The first activity contains a Fragment, and there's a button inside the fragment, and when I click this button, I wish to jump to a new Activity with different animation. So I do it like this in the Fragment:

          mButton.setOnClickListener(new OnClickListener() {
               @Override
               public void onClick(View v) {
                     Intent intent = new Intent(getActivity(), NewActivity.class);
                     getActivity().startActivity(intent);
                     getActivity().overridePendingTransition(
                           R.anim.forward_activity_move_in,
                           R.anim.forward_activity_move_out);
               });

However the new animation does not take effect when moves to the new Activity, so I wonder maybe I do it wrong. I hope someone can help me, thx a lot:)

1 Answers
Related