Strange NullPointerException in onResume
<p>I've been seeing this NullPointerException pop up for my users in my crash trackers. I have not been able to reproduce it myself, and the most mystifying part of it for me is that the exception itself seems to occur in the Android Activity class--at a line, at which, from looking at the Android source, there is no code at all. </p>

<p>Here is the stack trace:</p>

<pre><code>java.lang.RuntimeException: Unable to resume activity {com.catherineapp.android/com.catherineapp.android.HomeAct}: java.lang.NullPointerException
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2448)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2476)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1990)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4477)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at android.app.Activity.onResume(Activity.java:1212)
at com.catherineapp.android.CABaseAct.onResume(CABaseAct.java:69)
at com.catherineapp.android.HomeAct.onResume(HomeAct.java:468)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1156)
at android.app.Activity.performResume(Activity.java:4775)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2438)   
... 12 more
java.lang.NullPointerException
at android.app.Activity.onResume(Activity.java:1212)
at com.catherineapp.android.CABaseAct.onResume(CABaseAct.java:69)
at com.catherineapp.android.HomeAct.onResume(HomeAct.java:468)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1156)
at android.app.Activity.performResume(Activity.java:4775)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2438)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:2476)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1990)
at android.app.ActivityThread.access$600(ActivityThread.java:127)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1151)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4477)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>The code at line <code>com.catherineapp.android.CABaseAct.onResume(CABaseAct.java:69)</code> is simply: 
<code>super.onResume();</code></p>

<p>I'm looking at the Android source code at <a href="http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/app/Activity.java?av=f" rel="nofollow">http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.0.3_r1/android/app/Activity.java?av=f</a></p>

<p>Here is the <code>onPause</code> method of my <code>HomeAct</code>: </p>

<pre><code>@Override
public void onPause() {
    super.onPause();
    this.unregisterReceiver(mMessageReceiver);
    this.unregisterReceiver(mChallengeReceiver);
}
</code></pre>

<p>Here's the <code>onResume</code> method of my <code>HomeAct</code>:</p>

<pre><code>@Override
public void onResume() {
    super.onResume();

    refreshData();
    if (mMessageReceiver == null)
        mMessageReceiver = new MessageBroadcastReceiver();
    IntentFilter messageFilter = new IntentFilter(CAService.INTERNAL_MESSAGE_STATUS_UPDATE);
    messageFilter.setPriority(0);
    this.registerReceiver(mMessageReceiver, messageFilter);

    if (mChallengeReceiver == null)
        mChallengeReceiver = new ChallengeBroadcastReceiver();
    IntentFilter challengeFilter = new IntentFilter(CAService.INTERNAL_CHALLENGE_STATUS_UPDATE);
    challengeFilter.setPriority(0);
    this.registerReceiver(mChallengeReceiver, challengeFilter);

    showFeedbackRequest();

}
</code></pre>

<p>Here is the <code>onResume</code> implementation of <code>CABaseAct</code>:</p>

<pre><code>@Override
public void onResume() {
    super.onResume();

    // track each Activity creation as a result event
    String activityName = this.getClass().getName().replace("com.catherineapp.android.", "");
    TrackDao.track(activityName + ".onResume");
}
</code></pre>

<p>The error occurs in the Activity.onResume() call, which is cascaded to through the <code>super.onResume()</code> calls which are the first calls I make in my overridden <code>onResume()</code> calls.</p>
