title: Want image in my android app to pause for 5 seconds and then slide off screen to the left
body: <p>when the app opens I want the image to appear immediately and remain still for 5 seconds and then after those 5 seconds have the image slide off screen to the left, instead my image appears like I want it but as soon as it appears it immediately begins to slides off screen, I would like to achieve this animation in code and not in xml. appreciate any advice, thank you.</p>
  
  <pre><code>package your.package2.test3;
  
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.animation.AnimationSet;
  import android.view.animation.TranslateAnimation;
  import android.widget.ImageView;
  
  public class Test3Activity extends Activity {
  
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      ImageView img = (ImageView) findViewById(R.id.img1);
  
      AnimationSet animSet = new AnimationSet(true);
  
      TranslateAnimation Anim1 = new TranslateAnimation(0,0,0,0);
      Anim1.setDuration(5000);
      TranslateAnimation Anim2 = new TranslateAnimation(0,-300,0,0);
      Anim2.setDuration(2000);
      animSet.addAnimation(Anim1);
      animSet.addAnimation(Anim2);
      img.startAnimation(animSet);
      }  
  }
  </code></pre>