title: sliding animations in android between activities in the same tab
body: <p>I have an <code>ActivityGroup</code> meant to develop a <code>tabHost</code>. One of the tabs contains two activities into it. The problem is that when I move between this two activities there is no sliding between them. The old activity dissappears and the new one comes automatically on screen.</p>
  
  <p>What I need to implement is this - when I move from activity2 back to activity 1, the activity2 has to leave the screen by sliding to the right and the new activity(activity 1) has to come into the screen by sliding from left to right.</p>
  
  <p>The effect is similar to android default style when an intent is used to move between activities!</p>
  
  <p>What I have achieved so far is: </p>
  
  <p>when I try to move from activity 2 to activity 1: activity 2( the old one) dissapears from the screen, the screen turns black and the new activity comes into the screen by sliding from left to right.  It would be great if I would manage to make the old activity to leave the screen by sliding too.</p>
  
  <p>This is my code for coming back from the old activity to the new one:</p>
  
  <pre><code>Animation animation = null;
  
   Window oldWindow = manager.getCurrentActivity().getWindow();
  
   if(oldWindow != null)
   {
   animation = AnimationUtils.loadAnimation(this, R.anim.right_to_left);    
   View v =oldWindow.getDecorView();
   v.startAnimation(animation);
  
   }
  
   manager.destroyActivity(mIdList.get(index), true);
   mIdList.remove(index); index--;
  
   String lastId = mIdList.get(index);
   lastIntent = manager.getActivity(lastId).getIntent();
   newView = manager.startActivity(lastId, lastIntent).getDecorView();
   newView.startAnimation(AnimationUtils.loadAnimation(this, R.anim.left_to_right));
  
   if(newView != null)
   {
   setContentView(newView);
   }
  
  One big bug is this: if I remove this line from my code: `setContentView(newView)` I get the desired effect for the old activity. Meaning the old activity leaves the screen by sliding, but the new one never comes in.
  </code></pre>
  
  <p>If I put that line back the old activity doesn't do any sliding just dissapears!!!!</p>
  
  <p>I use a Samsung Galaxy for testing and I tried to use <code>overridePendingTransition</code> but it has no effect on the animations.</p>
  
  <p>Here are my <code>xml</code> files:</p>
  
  <pre><code>right_to_left.xml
  
  &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
           android:shareInterpolator="true"&gt;
        &lt;translate
         android:fromXDelta="0%" android:toXDelta="100%"
         android:fromYDelta="0%" android:toYDelta="0%"
         android:duration="3500" /&gt;
      &lt;/set&gt;
  
  
   left_to_right.xml
  
  
   &lt;set xmlns:android="http://schemas.android.com/apk/res/android"
           android:shareInterpolator="true"&gt;
          &lt;translate android:fromXDelta="-100%" android:toXDelta="0%"
            android:fromYDelta="0%" android:toYDelta="0%"
           android:duration="3500"/&gt;
         &lt;/set&gt;
  </code></pre>
  
  <p>Thank you. Hope you can help me.</p>