title: Activity navigation: custom animation with popEnter and popExit like fragments
body: <p>Changing activities with an animation is possible using the code below:</p>
  
  <pre class="lang-java prettyprint-override"><code>Bundle animation = ActivityOptions.makeCustomAnimation(App.getContext(), R.anim.enter_from_right, R.anim.exit_to_left).toBundle();
  startActivity(intent, animation);
  </code></pre>
  
  <p>For fragments you can do something similar on FragmentTransaction:</p>
  
  <pre class="lang-java prettyprint-override"><code>// ...
  transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left);
  // ...
  </code></pre>
  
  <p>This works!
  But I'd like to have an animation when pressing back (pop from backstack).
  For fragments you simply add 2 anim resources (popEnter &amp; popExit):</p>
  
  <pre class="lang-java prettyprint-override"><code>transaction.setCustomAnimations(R.anim.enter_from_right, R.anim.exit_to_left, R.anim.enter_from_left, R.anim.exit_to_right);
  </code></pre>
  
  <p>How can I create the same 'back-animation' for activities?</p>