Closed onecoders closed 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(); }
The key to solve this bug is to use commitAllowingStateLoss() instead of commit().