onAnimationEnd() Causing app to close
<p>am currently following a book called Sams Teach yourself Android Development in 24 hours. </p>

<p>Things have been going fine till hour 7 where the book teach how to listen for animation end before transisting to another screen (ie splash to menu)</p>

<p>Below are my code. Do help me out. been trying to debug and logcat gives me a 03-06 13:56:57.045: ERROR/AndroidRuntime(746): Uncaught handler: thread main exiting due to uncaught exception.</p>

<p>QuizSplashActivity.Java</p>

<pre><code>  package com.android.triviaquiz;

import android.content.Intent;
import android.os.Bundle;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.view.animation.LayoutAnimationController;
import android.view.animation.Animation.AnimationListener;
import android.widget.TableLayout;
import android.widget.TableRow;
import android.widget.TextView;

public class QuizSplashActivity extends QuizActivity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash);
        startAnimation();
    }

    private void startAnimation() {
        // TODO Auto-generated method stub
        TextView logo1 = (TextView) findViewById(R.id.TextViewTopTitle);
        Animation fade1 = AnimationUtils.loadAnimation(this, R.anim.fade_in);
        logo1.startAnimation(fade1);

        TextView logo2 = (TextView) findViewById(R.id.TextViewBottomTitle);
        Animation fade2 = AnimationUtils.loadAnimation(this, R.anim.fade_in2);
        logo2.startAnimation(fade2);
        fade2.setAnimationListener(new AnimationListener(){
            public void onAnimationEnd(Animation animation){
                startActivity(new Intent(QuizSplashActivity.this,QuizMenuActivity.class));
                QuizSplashActivity.this.finish();

            }


            public void onAnimationRepeat(Animation animation) {
                // TODO Auto-generated method stub

            }


            @Override
            public void onAnimationStart(Animation animation) {
                // TODO Auto-generated method stub

            }




        });
        Animation spinin = AnimationUtils.loadAnimation(this, R.anim.custom_anim);
        LayoutAnimationController controller = new LayoutAnimationController(spinin);
        TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
        for (int i = 0; i &lt; table.getChildCount(); i++) {
            TableRow row = (TableRow) table.getChildAt(i);
            row.setLayoutAnimation(controller);
        }
    }

    @Override 
    protected void onPause() {
        super.onPause();
        //stop the animation
        TextView logo1 = (TextView) findViewById(R.id.TextViewTopTitle);
        logo1.clearAnimation();

        TextView logo2 = (TextView) findViewById(R.id.TextViewBottomTitle);
        logo2.clearAnimation();

        TableLayout table = (TableLayout) findViewById(R.id.TableLayout01);
        for (int i = 0; 1&lt; table.getChildCount(); i++){
            TableRow row = (TableRow) table.getChildAt(i);
            row.clearAnimation();
        }
    }   

}
</code></pre>

<p>Android Manifest.xml</p>

<pre><code> &lt;?xml version="1.0" encoding="utf-8"?&gt;
&lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="com.android.triviaquiz"
      android:versionCode="1"
      android:versionName="1.0"&gt;
    &lt;application android:icon="@drawable/quizicon" android:label="@string/app_name" android:debuggable="true"&gt;
        &lt;activity android:name=".QuizSplashActivity"
                  android:label="@string/app_name"&gt;
            &lt;intent-filter&gt;
                &lt;action android:name="android.intent.action.MAIN" /&gt;
                &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
            &lt;/intent-filter&gt;
        &lt;/activity&gt;

    &lt;activity android:name="QuizMenuActivity"&gt;&lt;/activity&gt;
&lt;/application&gt;
&lt;uses-sdk android:minSdkVersion="7"/&gt;

&lt;/manifest&gt; 
</code></pre>

<p>Full LogCat</p>

<pre><code>03-06 16:30:35.455: DEBUG/AndroidRuntime(775): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
03-06 16:30:35.465: DEBUG/AndroidRuntime(775): CheckJNI is ON
03-06 16:30:35.845: DEBUG/AndroidRuntime(775): --- registering native functions ---
03-06 16:30:36.405: DEBUG/ddm-heap(775): Got feature list request
03-06 16:30:37.116: DEBUG/AndroidRuntime(775): Shutting down VM
03-06 16:30:37.126: DEBUG/dalvikvm(775): DestroyJavaVM waiting for non-daemon threads to exit
03-06 16:30:37.126: DEBUG/dalvikvm(775): DestroyJavaVM shutting VM down
03-06 16:30:37.136: DEBUG/dalvikvm(775): HeapWorker thread shutting down
03-06 16:30:37.136: DEBUG/dalvikvm(775): HeapWorker thread has shut down
03-06 16:30:37.146: ERROR/AndroidRuntime(775): ERROR: thread attach failed
03-06 16:30:37.146: DEBUG/jdwp(775): JDWP shutting down net...
03-06 16:30:37.166: INFO/dalvikvm(775): Debugger has detached; object registry had 1 entries
03-06 16:30:37.166: DEBUG/dalvikvm(775): VM cleaning up
03-06 16:30:37.215: DEBUG/dalvikvm(775): LinearAlloc 0x0 used 628628 of 5242880 (11%)
03-06 16:30:37.815: DEBUG/AndroidRuntime(783): &gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt; AndroidRuntime START &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
03-06 16:30:37.815: DEBUG/AndroidRuntime(783): CheckJNI is ON
03-06 16:30:38.146: DEBUG/AndroidRuntime(783): --- registering native functions ---
03-06 16:30:38.825: DEBUG/ddm-heap(783): Got feature list request
03-06 16:30:39.575: INFO/ActivityManager(59): Starting activity: Intent { act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10000000 cmp=com.android.triviaquiz/.QuizSplashActivity }
03-06 16:30:39.655: DEBUG/AndroidRuntime(783): Shutting down VM
03-06 16:30:39.665: DEBUG/dalvikvm(783): DestroyJavaVM waiting for non-daemon threads to exit
03-06 16:30:39.685: DEBUG/dalvikvm(783): DestroyJavaVM shutting VM down
03-06 16:30:39.685: DEBUG/dalvikvm(783): HeapWorker thread shutting down
03-06 16:30:39.705: DEBUG/dalvikvm(783): HeapWorker thread has shut down
03-06 16:30:39.725: DEBUG/jdwp(783): JDWP shutting down net...
03-06 16:30:39.735: INFO/dalvikvm(783): Debugger has detached; object registry had 1 entries
03-06 16:30:39.745: DEBUG/dalvikvm(783): VM cleaning up
03-06 16:30:39.795: ERROR/AndroidRuntime(783): ERROR: thread attach failed
03-06 16:30:39.865: DEBUG/dalvikvm(783): LinearAlloc 0x0 used 638596 of 5242880 (12%)
03-06 16:30:39.915: INFO/ActivityManager(59): Start proc com.android.triviaquiz for activity com.android.triviaquiz/.QuizSplashActivity: pid=790 uid=10027 gids={}
03-06 16:30:40.196: DEBUG/ddm-heap(790): Got feature list request
03-06 16:30:41.455: INFO/ActivityManager(59): Displayed activity com.android.triviaquiz/.QuizSplashActivity: 1799 ms (total 30322 ms)
03-06 16:30:46.295: INFO/ActivityManager(59): Starting activity: Intent { cmp=com.android.triviaquiz/.QuizMenuActivity }
03-06 16:30:46.365: DEBUG/AndroidRuntime(790): Shutting down VM
03-06 16:30:46.365: WARN/dalvikvm(790): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
03-06 16:30:46.375: ERROR/AndroidRuntime(790): Uncaught handler: thread main exiting due to uncaught exception
03-06 16:30:46.435: ERROR/AndroidRuntime(790): java.lang.RuntimeException: Unable to pause activity {com.android.triviaquiz/com.android.triviaquiz.QuizSplashActivity}: java.lang.NullPointerException
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3162)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3119)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3102)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.access$2400(ActivityThread.java:119)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1870)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.os.Looper.loop(Looper.java:123)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.main(ActivityThread.java:4363)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at java.lang.reflect.Method.invokeNative(Native Method)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at java.lang.reflect.Method.invoke(Method.java:521)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at dalvik.system.NativeStart.main(Native Method)
03-06 16:30:46.435: ERROR/AndroidRuntime(790): Caused by: java.lang.NullPointerException
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at com.android.triviaquiz.QuizSplashActivity.onPause(QuizSplashActivity.java:77)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.Activity.performPause(Activity.java:3782)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.Instrumentation.callActivityOnPause(Instrumentation.java:1190)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     at android.app.ActivityThread.performPauseActivity(ActivityThread.java:3149)
03-06 16:30:46.435: ERROR/AndroidRuntime(790):     ... 12 more
03-06 16:30:46.485: INFO/Process(59): Sending signal. PID: 790 SIG: 3
03-06 16:30:46.485: INFO/dalvikvm(790): threadid=7: reacting to signal 3
03-06 16:30:46.565: INFO/dalvikvm(790): Wrote stack trace to '/data/anr/traces.txt'
03-06 16:30:46.825: WARN/ActivityManager(59): Activity pause timeout for HistoryRecord{43db5470 com.android.triviaquiz/.QuizSplashActivity}
03-06 16:30:49.645: WARN/ActivityManager(59): Launch timeout has expired, giving up wake lock!
03-06 16:30:50.340: WARN/ActivityManager(59): Activity idle timeout for HistoryRecord{43db5470 com.android.triviaquiz/.QuizSplashActivity}
03-06 16:30:56.847: WARN/ActivityManager(59): Activity idle timeout for HistoryRecord{43dd6cf8 com.android.triviaquiz/.QuizMenuActivity}
03-06 16:31:00.245: DEBUG/dalvikvm(59): GC freed 17596 objects / 838928 bytes in 183ms
03-06 16:31:00.355: WARN/ActivityManager(59): Activity destroy timeout for HistoryRecord{43db5470 com.android.triviaquiz/.QuizSplashActivity}
</code></pre>
