title: Moving from start up screen to loading screen in android app
body: <p>I set an android startup screen to my app, so that I can move directly after clicking on it to a loading screen (which is a frame animation). The problem is that my app closes directly when clicking on my startup screen. Can you please tell me what's wrong with my program?</p>
  
  <p>Here is my main activity code:</p>
  
  <pre><code>package test.com.myapplication;
  
  import android.app.Activity;
  import android.graphics.drawable.AnimationDrawable;
  import android.os.Bundle;
  import android.view.Menu;
  import android.view.MenuItem;
  import android.view.View;
  import android.widget.ImageButton;
  import android.widget.ImageView;
  import android.widget.RelativeLayout;
  import android.widget.Toast;
  
  
  public class MyActivity extends Activity {
  
      private AnimationDrawable frameAnimation;
      private ImageView view;
      ImageButton start;
      RelativeLayout background;
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_my);
          start = (ImageButton) findViewById(R.id.startup);
          view = (ImageView) findViewById(R.id.imageAnimation);
          frameAnimation = (AnimationDrawable) view.getBackground();
          start.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View view) {
                  frameAnimation.start();
              }
          });
      }
  }
  </code></pre>
  
  <p>and the XML files i created : 
  layout file :</p>
  
  <pre><code>   &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:id="@+id/back"
  
  
      tools:context=".MyActivity"&gt;
  
      &lt;ImageButton
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:src="@drawable/startup"
          android:id="@+id/startup"
          /&gt;
  
  
      &lt;ImageView
          android:id="@+id/imageAnimation"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:adjustViewBounds="true" /&gt;
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>and the animation file</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  
  
      &lt;item android:drawable="@drawable/frame01" android:duration="210"/&gt;
      &lt;item android:drawable="@drawable/frame02" android:duration="210"/&gt;
      &lt;item android:drawable="@drawable/frame03" android:duration="210"/&gt;
      &lt;item android:drawable="@drawable/frame04" android:duration="210"/&gt;
      &lt;item android:drawable="@drawable/frame05" android:duration="210"/&gt;
      &lt;item android:drawable="@drawable/frame06" android:duration="210"/&gt;
  
  
  &lt;/animation-list&gt;
  </code></pre>