The app only crashes when the SubscriptionActivity is visited while the SearchFragment is on top the MainActivtiy fragment manager stack, which always has HomeFragment inserted. The problem is hard to debug as it happens at different times due to loss of state.
Basically, IllegalStateExceptionis thrown when a commit is done without guarantee that the state is saved.
The app only crashes when the
SubscriptionActivity
is visited while theSearchFragment
is on top theMainActivtiy
fragment manager stack, which always hasHomeFragment
inserted. The problem is hard to debug as it happens at different times due to loss of state.Basically,
IllegalStateException
is thrown when a commit is done without guarantee that the state is saved.Additional read: http://www.androiddesignpatterns.com/2013/08/fragment-transaction-commit-state-loss.html
The solution was found on SO and it explains why the problem happens.