I think it's not the beautifulest way but this is what i did to solve it:

Fragment:

Intent intent = new Intent(activity, FragmentActivity.class);
Bundle bundle = ActivityOptions.makeCustomAnimation(activity, R.anim.slide_in_left, R.anim.slide_out_left).toBundle();
activity.startActivity(intent, bundle);
activity.finish();

FragmentActivity:

Intent intent = new Intent(this, Activity.class); // the activity that holds the fragment
Bundle bundle = ActivityOptions.makeCustomAnimation(this, R.anim.slide_in_right, R.anim.slide_out_right).toBundle();
startActivity(intent, bundle);

The disadvantage might be to save everything in the activity that is holding the fragment.

http://stackoverflow.com/questions/18810994/no-animation-when-switching-from-fragment-to-activity-and-back

+ Recent posts