Merge pull request #866 from TomHennen/fix_846
Avoid IllegalStateExceptions
This commit is contained in:
commit
8eaeacb200
|
@ -332,7 +332,13 @@ public class MainActivity extends ActionBarActivity implements NavDrawerActivity
|
||||||
FragmentTransaction t = fragmentManager.beginTransaction();
|
FragmentTransaction t = fragmentManager.beginTransaction();
|
||||||
t.replace(R.id.main_view, fragment, "main");
|
t.replace(R.id.main_view, fragment, "main");
|
||||||
fragmentManager.popBackStack();
|
fragmentManager.popBackStack();
|
||||||
t.commit();
|
// TODO: we have to allow state loss here
|
||||||
|
// since this function can get called from an AsyncTask which
|
||||||
|
// could be finishing after our app has already committed state
|
||||||
|
// and is about to get shutdown. What we *should* do is
|
||||||
|
// not commit anything in an AsyncTask, but that's a bigger
|
||||||
|
// change than we want now.
|
||||||
|
t.commitAllowingStateLoss();
|
||||||
if (navAdapter != null) {
|
if (navAdapter != null) {
|
||||||
navAdapter.notifyDataSetChanged();
|
navAdapter.notifyDataSetChanged();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue