Commit 74a65049 authored by Ludovic Fauvet's avatar Ludovic Fauvet
Browse files

Fix an IllegalStateException related to the onSaveInstanceState call

The error appears because we're attaching a new fragment in the onResume
and this method is sometimes called after onSaveInstanceState which
leads to a crash.
We can safely discard the state in this specific case because we don't
rely on the UI state but on the mMediaLibraryActive boolean to read the
actual state of the directory view.
parent 739cb25b
......@@ -334,7 +334,7 @@ public class MainActivity extends SherlockFragmentActivity {
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);
/* Load directory view fragment */
ft.attach(mDirectoryView);
ft.commit();
ft.commitAllowingStateLoss();
mMediaLibraryActive = false;
}
......@@ -348,7 +348,7 @@ public class MainActivity extends SherlockFragmentActivity {
mActionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
/* Remove the directory view from the tabs */
ft.detach(mDirectoryView);
ft.commit();
ft.commitAllowingStateLoss();
mMediaLibraryActive = true;
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment