title: How to override onBackPressed() with overridePendingTransition() animation
body: <p><code>PlayPanel</code> activity should close in the form of a sliding panel to <code>MainActivity</code> when back button is pressed. However, there is no animation. <code>PlayPanel</code> activity simply closes normally.</p>
  
  <p><code>PlayPanel activity</code></p>
  
  <pre><code>public class PlayPanel extends AppCompatActivity {
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_play_panel);
      }
  
      @Override
      public void onBackPressed() {
  
          Intent intent = new Intent(
               PlayPanel.this,
               MainActivity.class
               );
  
          startActivity(intent);
  
          overridePendingTransition(
               0, 
               R.anim.play_panel_close_background
               );
      }
  
      // onCreateOptionsMenu goes here
  
      // onOptionsItemSelected goes here
  }
  </code></pre>
  
  <p><code>play_panel_close_background.xml</code></p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"&gt;
      &lt;translate
          android:fromYDelta="0%"
          android:toYDelta="100%"
          android:duration="600"
          /&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p><code>the solution:</code></p>
  
  <pre><code> @Override
      public void onBackPressed() {
          super.onBackPressed();
          //startActivity(new Intent(this, MainActivity.class));
          overridePendingTransition(
                  0,
                  R.anim.play_panel_close_outgoing_activity
          );
      }
  </code></pre>