致命异常:java.lang.IllegalStateException在onSaveInstanceState之后无法执行此操作

时间:2015-02-25 14:58:49

标签: java android

我遇到了无法重现的崩溃。这是堆栈跟踪:

android.support.v4.app.FragmentManagerImpl.checkStateLoss (FragmentManager.java:1343)
android.support.v4.app.FragmentManagerImpl.popBackStackImmediate (FragmentManager.java:486)
android.support.v4.app.FragmentActivity.onBackPressed (FragmentActivity.java:179)
com.test.radio.RadioPlayer.onBackPressed (RadioPlayer.java:2372)

这是RadioPlayer.java中的相关代码:

    @Override
    public void onBackPressed() {
        if(isTaskRoot()){
            startActivity(new Intent(this,SplashScreen.class));
            this.finish(); // this is line 2372
        } else {
            super.onBackPressed();
        }
    }

    @Override
    protected void onSaveInstanceState(Bundle outState) {
        outState.putInt("PlayState", currentAction);
        super.onSaveInstanceState(outState);
    }

感谢任何帮助。

0 个答案:

没有答案