public boolean onOptionsItemSelected(MenuItem item) { FragmentTransaction ft = fm.beginTransaction(); switch (item.getItemId()) { case R.id.menu_additionbtn: /* * start the activity that allows users to enter in new twitter user * accounts */ ModifyTweetersFragment frag = new ModifyTweetersFragment(); ft.add(R.id.activity_tweetslist_container, frag, ModifyTweetersFragment.class.getName()); ft.addToBackStack( null); // adding to the backstack allows us to revert the last transaction and thus // return to tweeter list afterwards ft.commit(); isEditing = true; invalidateOptionsMenu(); break; case R.id.menu_load_tweeter_btn: onBackPressed(); invalidateOptionsMenu(); break; case R.id.menu_refresh_btn: case R.id.menu_refreshlisting_settings: /* * user may press refresh button, force the loader to get new data * in this case */ mFragmentListCallback.requestRefresh(); break; case R.id.menu__delete_all_settings: deleteAllTweetListEntries(); break; case R.id.menu_quickread_settings: mMultiColumn = !mMultiColumn; mFragmentListCallback.requestMultiColumn(mMultiColumn); break; default: return true; } return false; }
/* make any fragment method calls after the fragments have been resumed */ @Override protected void onResumeFragments() { // TODO Auto-generated method stub super.onResumeFragments(); if (isFromSavedState) { mFragmentListCallback.changePage(restoredIndex); isFromSavedState = false; } }