Note that there are some explanatory texts on larger screens.

plurals
  1. POPop the fragment backstack without playing the Pop-Animation
    primarykey
    data
    text
    <p>I push a fragment on the fragment stack using the following code:</p> <pre><code>FragmentManager fragmentManager = getActivity().getSupportFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_right, R.anim.slide_in_left, R.anim.slide_out_left); fragmentTransaction.replace(getId(), newFragment); fragmentTransaction.addToBackStack(null); fragmentTransaction.commit(); </code></pre> <p>This way, when the fragment stack is popped, e.g. by pressing the back button, a fragment pop animation is played. However, there are situations in which i would like to pop the fragment backstack without showing this animation, e.g. because I just returned from another activity and want to display the previous fragment at once, without animation.</p> <p>An example navigation could look like this:</p> <ul> <li>The user is on the start screen with the root fragment</li> <li>He selects an item on the root fragment which then displays a new fragment to show details of that item. It does so using a fragment transaction that sets animations both for the push and the pop case (so when the user presses the back button, the transition is animated)</li> <li>From this fragment he starts an activity which (for whatever reason) deletes the item that was just shown</li> <li>When this activity finishes, I would like to return to the root fragment without showing the "pop animation" of the "detail fragment"</li> </ul> <p>Is there a way to pop the fragment backstack without playing the specified pop animation?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload