djj0809
djj0809

Reputation: 111

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

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:)

Upvotes: 8

Views: 10635

Answers (1)

djj0809
djj0809

Reputation: 111

Thanks, I solved this problem, You can find solutions at Change activity transition when inside a TabHost

Well the problem is not the case of Fragment, instead the TabActivity causes the problem.

Upvotes: 3

Related Questions