title: overridePendingTransition for sliding activities in and out smoothly
body: <p>I'm having trouble figuring out how to slide activities in and out with a push of a button.  What I want is for the user to push a button and then the screen slides.  The way I want it is for the 1st activity (the one with the button) to slide out to the left while the new 2nd activity slides in from the right.</p>
  
  <p>With the below code, when the button is clicked, the 1st activity slides out to the right when I want it to slide out to the left.  Then when it is done sliding, all that is remaining is a black screen for a split second and then the 2nd activity just appears and does not slide in.</p>
  
  <p>So the 1st activity is sliding out the incorrect direction and the next activity just appears instead of sliding.  What am I doing wrong?  I am having a hard time understanding the XML files so hear is the code for everything below.</p>
  
  <p>1st activity</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
  
      playBtn.setOnClickListener(new OnClickListener() {
          public void onClick(View v) {
              Intent intent = new Intent(MainMenu.this, Levels.class);
              startActivity(intent);
              overridePendingTransition(R.anim.enter_from_right, R.anim.exit_out_left);
          }
      });
  </code></pre>
  
  <p>2nd activity</p>
  
  <pre><code>@Override
  public void onCreate(Bundle savedInstanceState) {
      requestWindowFeature(Window.FEATURE_NO_TITLE);
      super.onCreate(savedInstanceState);
      setContentView(R.layout.levels);
  
      overridePendingTransition(R.anim.enter_from_left, R.anim.exit_out_right);
  </code></pre>
  
  <p>So I am thinking that some of my XML files might be incorrect.  Here they are.</p>
  
  <p>enter_from_left.xml</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:duration="600"
          android:fromXDelta="100%"
          android:toXDelta="0%" &gt;
      &lt;/translate&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>enter_from_right.xml</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:duration="600"
          android:fromXDelta="-100%"
          android:toXDelta="0%" &gt;
      &lt;/translate&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>exit_out_left.xml</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:duration="600"
          android:fromXDelta="0%"
          android:toXDelta="-100%" &gt;
      &lt;/translate&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p>exit_out_right.xml</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:duration="600"
          android:fromXDelta="0%"
          android:toXDelta="100%" &gt;
      &lt;/translate&gt;
  &lt;/set&gt;
  </code></pre>
  
  <p><strong>EDIT</strong>
  Removing the <code>overridePendingTransition()</code> from the 2nd activity made it so the 1st activity slides out to the left which is what I wanted.  But, when the 1st activity slides away, it still is just revealing a black screen instead of having the 2nd activity slide in from the right.</p>