2

On navigation from 1 fragment to another I am using slide animation. So, when i use the PopBackStack function, it moves from the left to the right like i was not going back, but moving forward. I mean, when i slide the page back it slide out to left side and the "new" page slide in from right. I want the opposite. Slide out right -> slide in left.

Because I can't set up the animation to PopBackStack directly, I tried to get the last fragment and call it like it was a new fragment.

Android.Support.V4.App.FragmentTransaction fragTx = fragmentActivity.SupportFragmentManager.BeginTransaction();
                fragTx.SetCustomAnimations(inAnimation, outAnimation, inAnimation, outAnimation);
                if (addToBackStack) fragTx.AddToBackStack(null);
                fragTx.Replace(Resource.Id.MML_content_frame, fragment);
                fragTx.Commit();

So, I tried to get the back stack entry by using the SupportFragmentManager, but despite it show me that have the right entries, the GetBackStackEntryAt function returns me null, so i can't get the name from the Fragment.

if (this.Activity.SupportFragmentManager.BackStackEntryCount == 0)
{
    return null;
}
String fragmentTag = Activity.SupportFragmentManager.GetBackStackEntryAt(Activity.SupportFragmentManager.BackStackEntryCount - 1).Name;
return Activity.SupportFragmentManager.FindFragmentByTag(fragmentTag);

Someone already had the same problem or similar? Is there a way to specify a new animation and set it with setCustomAnimations function or do it directly to PopBackStack?

Thank you.

0 Answers0