title: gradient background fade-out and going to another page
body: <p>I have page with gradient background and I also have an anim XML page to change the alpha from 1 to 0 ,I tried to fade out background and then go to another page but the problem is when  the duration finish (background fade out) and it want to go to another page background  for one second appear in screen.what can I do with this problem?</p>
  
  <p>anim/fade_out.xml</p>
  
  <pre><code>&lt;alpha xmlns:android="http://schemas.android.com/apk/res/android"
  android:fromAlpha="1.0"
  android:toAlpha="0.0"
  android:duration="4000" &gt;
  
  &lt;/alpha&gt;
  </code></pre>
  
  <p>drawable/linegradient.xml</p>
  
  <pre><code>&lt;shape xmlns:android="http://schemas.android.com/apk/res/android"
  android:shape="rectangle" &gt;
  &lt;gradient
      android:centerX="20%"
      android:endColor="#aed36c"
      android:startColor="#44c8f5" /&gt;
  
  &lt;/shape&gt;
  </code></pre>
  
  <p>MainActivity.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:id="@+id/firstpage"
  android:background="@drawable/linergradiant"
  
  android:orientation="vertical" &gt;
  &lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="@drawable/texture" &gt;
  
      &lt;LinearLayout
          android:layout_width="200dip"
          android:layout_height="200dip"
          android:layout_centerHorizontal="true"
          android:layout_centerVertical="true"
          android:layout_marginTop="116dp"
          android:background="@drawable/logo_big2" &gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>MainActivity.java</p>
  
  <pre><code>public class MainActivity extends ActionBarActivity implements AnimationListener {
   LinearLayout screen;
  // Handler handler = new Handler();
   int i;
   Intent intent;
   Animation animFadeout;
   Animation animFadein;
   @Override
   protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      screen=(LinearLayout) findViewById(R.id.firstpage);
      animFadeout=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_out );
  
      animFadeout.setAnimationListener(this);
  
      screen.post(new Runnable() {
  
          @Override
          public void run() {
              screen.startAnimation(animFadeout); 
          }
      }); 
  
  }
  
  @Override
  public void onAnimationEnd(Animation arg0) {
      animFadein=AnimationUtils.loadAnimation(getApplicationContext(),R.anim.fade_in );
      animFadein.setAnimationListener(new AnimationListener() {
  
          @Override
          public void onAnimationStart(Animation arg0) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onAnimationRepeat(Animation arg0) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void onAnimationEnd(Animation arg0) {
              startActivity(new Intent(getApplicationContext(),BMIcalculator.class)); 
  
          }
      });
       screen.startAnimation(animFadein);
  
  }
  @Override
  public void onAnimationRepeat(Animation arg0) {
  
  }
  @Override
  public void onAnimationStart(Animation arg0) {
      // TODO Auto-generated method stub  
  }
  
  }
  </code></pre>