In my main action, the contents of the fragments are displayed. If I press the button, another action will start with this line of code:
Intent intent = new Intent(context, FragmentActivity.class); Bundle bundle = ActivityOptions.makeCustomAnimation(context, R.anim.slide_in_left, R.anim.slide_out_left).toBundle(); context.startActivity(intent, bundle);
Thus, the new activity should be included in the slide, and the current activity should be rejected. The problem is that the new activity is animated correctly. The current fragment has no animation.
Update
This solves the problem, but I do not want to end my activity.
finish(); startActivity(intent); overridePendingTransition(R.anim.slide_in_left, R.anim.slide_out_left);
End of update
If I press the back button in FragmentActivity, I have another animation:
@Override protected void onBackPressed() { super.onBackPressed(); overridePendingTransition(R.anim.slide_in_right, R.anim.slide_out_right); }
Here again, only the FragmentActivity animation (R.anim.slide_out_right) works. Animation (R.anim.slide_in_right), which should animate Main, does not work.
Here is what I'm trying to create: YouTube