在我的代碼我得到
java.lang.IllegalStateException: Can not perform this action after onSaveInstanceState
坡平返回堆棧,而不會導致IllegalStateException異常
和我搜索statckoverflow我得到了下面的代碼解決方案。
現在我沒有得到IllegalStateException,但問題是..下面的代碼是清除整個堆棧跟蹤。但我只想彈出最後一個交易/入口在後臺。怎麼做??
if (getSupportFragmentManager().getBackStackEntryCount() > 0) {
getSupportFragmentManager().popBackStack(getSupportFragmentManager().getBackStackEntryAt(0).getId(), FragmentManager.POP_BACK_STACK_INCLUSIVE);
}
如何只彈出最後一個事務/條目在後臺?
碼的我是多麼添加到堆棧:
fragmentManager.beginTransaction().
setCustomAnimations(R.anim.slide_in_left, R.anim.slide_in_left, R.anim.slide_out_right, R.anim.slide_out_right).
replace(R.id.content_frame, pageFragment, currentItem).
addToBackStack(currentItem).
commit();
發佈您的片段添加代碼plz。 –