onecoders / NetEase

NetEase Example
6 stars 6 forks source link

TODO fix the crash bug caused by commit after no onSaveState #66

Closed onecoders closed 10 years ago

onecoders commented 10 years ago
private void initNewCatalogByMenu(MenuItem item) {
    CatalogFragment fragment = new CatalogFragment();
    Bundle extra = new Bundle();
    if (item != null) {
        extra.putInt(CatalogFragment.MENU_ID, item.getMenuId());
        extra.putString(CatalogFragment.CATALOG_TITLE, item.getMenuName());
    }
    fragment.setArguments(extra);
    getSupportFragmentManager().beginTransaction()
            .replace(R.id.content_frame, fragment)
            .commitAllowingStateLoss();
}
onecoders commented 10 years ago

The key to solve this bug is to use commitAllowingStateLoss() instead of commit().