Redgram / redgram-for-reddit

An Open-Sourced Android Reddit Client
GNU General Public License v3.0
102 stars 19 forks source link

App crashes when a subreddit is requested from the SubscriptionFragment #31

Closed mhdatie closed 8 years ago

mhdatie commented 8 years ago

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.

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.