java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState

最近帖子最終頁有個報錯信息java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState。
大概意思是執行onSaveInstanceState後,不行執行下面的行爲,也可以說無響應。

看代碼,當前activity裏嵌套了一個Fragment,沒有其他邏輯了嵌套方式如下:

getSupportFragmentManager().beginTransaction() .replace(R.id.container, mTopicFragment).commitAllowingStateLoss();

報錯位置在super.onBackPressed();

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

我現在的處理方式爲:

    @Override
public void onBackPressed() {
    //super.onBackPressed();
    finish();
}

同時也參考了
http://zhiweiofli.iteye.com/blog/1539467

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章