FragmentTransactioncommit() 했을 때 Activity의 onSaveInstanceState(Bundle)이 실행된 후라면 다음과 같은 에러 메시지를 보게 된다.

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

이 문제의 원인이 무엇인지, 어떻게 이 Exception을 피할지, 그리고 commitAllowingStateLoss()가 왜 마지막 수단이 되어야 하는지 잘 설명한 글이 있어 소개한다. Alex Lockwood가 쓴 Fragment Transaction과 Activity State Loss에 관한 글이다.