Android App崩溃onPause

时间:2013-06-10 16:39:32

标签: android crash onpause

我正在开发一个带有ActionbarSherlock和Fragments的应用程序(不确定是否相关)。

我收到了MainActivity onPause()的应用程序崩溃,我不知道为什么......

这是发生这种情况时的LogCat错误:

FATAL EXCEPTION: main
java.lang.RuntimeException: Unable to pause activity {com.example.myapp/com.example.myapp.MainActivity}: java.lang.NullPointerException
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2354)
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2311)
    at android.app.ActivityThread.handlePauseActivity(ActivityThread.java:2291)
    at android.app.ActivityThread.access$1700(ActivityThread.java:117)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:938)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loop(Looper.java:123)
    at android.app.ActivityThread.main(ActivityThread.java:3683)
    at java.lang.reflect.Method.invokeNative(Native Method)
    at java.lang.reflect.Method.invoke(Method.java:507)
    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
    at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
    at android.support.v4.app.FragmentManagerImpl.saveFragmentBasicState(FragmentManager.java:1576)
    at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1617)
    at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:481)
    at com.actionbarsherlock.app.SherlockFragmentActivity.onSaveInstanceState(SherlockFragmentActivity.java:127)
    at com.example.myapp.MainActivity.onSaveInstanceState(MainActivity.java:80)
    at android.app.Activity.performSaveInstanceState(Activity.java:1037)
    at android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1181)
    at android.app.ActivityThread.performPauseActivity(ActivityThread.java:2336)

我的活动已经实现了默认的onPause方法(以及其他方法,请求)

@Override
public void onPause() {
    super.onPause();
}

@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
    super.onSaveInstanceState(savedInstanceState);
}

@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
    super.onRestoreInstanceState(savedInstanceState);
}

我认为它可能与ActionbarSherlock有关,导致错误消息就是这样。 任何你可以投掷的光,将不胜感激。我被卡住了。

0 个答案:

没有答案