Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<blockquote> <p>The user is on the start screen with the root fragment</p> </blockquote> <p>Lets say the root fragment is contained in Activity A.</p> <blockquote> <p>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)</p> </blockquote> <p>The transaction is added to the back stack. Which means that when the back button is pressed from detail fragment, the popping process is animated.</p> <blockquote> <p>From this fragment he starts an activity which (for whatever reason) deletes the item that was just shown.</p> </blockquote> <p>Lets say it is Activity B</p> <blockquote> <p>When this activity finishes, I would like to return to the root fragment without showing the "pop animation" of the "detail fragment"</p> </blockquote> <p>One way of getting this behavior is by doing this in Activity B :</p> <pre><code>Intent intent = new Intent(this, A.class); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(intent); finish(); </code></pre> <p>This will start the Activity A resetting it to its root state according to the <a href="http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP" rel="noreferrer">documentation</a>.(check the last paragraph in the section which says "This launch mode can also be used to good effect in conjunction with FLAG_ACTIVITY_NEW_TASK:......")</p> <p>With this configuration, the animation will be present in the default case while in the special case you can control the animation using :</p> <pre><code>intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION); </code></pre> <p>Which starts new activity without any animations. If you do want any animation, you can do it using the <code>overridePendingTransition</code> method.</p>
 

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