List of usage examples for android.app FragmentTransaction addToBackStack
public abstract FragmentTransaction addToBackStack(@Nullable String name);
From source file:edu.scranton.fisherc5.busybusy.MainActivity.java
public void setDailyViewFragment(Bundle args) { Fragment dailyViewFrag = new DailyViewFragment(); dailyViewFrag.setArguments(args);//from www.java 2s.c o m SimpleDateFormat format = new SimpleDateFormat("MMMM d, yyyy"); Calendar temp = new GregorianCalendar(); temp.setTimeInMillis(args.getLong(Keys.SELECTED_DATE_KEY)); getActionBar().setTitle(format.format(temp.getTime())); mDateInActionBar = true; //SET TRANSACTION. ADD TO BACK STACK FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, dailyViewFrag, "PRE_COMPARE"); transaction.addToBackStack("PRE_COMPARE_PUSH"); transaction.commit(); }
From source file:com.sharklee.navigationDrawer.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new PlanetFragment(); Bundle args = new Bundle(); args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position); //??PlanetFragment? fragment.setArguments(args);/*from w ww . ja v a 2 s .co m*/ //PlanetFragment?FrameLayout?? FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); fragmentTransaction.replace(R.id.content_frame, fragment); fragmentTransaction.addToBackStack(""); fragmentTransaction.commit(); // update selected item and title, then close the drawer //MainActivityposition=0?ListView?ListView?ListView?position=0 mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
private void updateActionHandler() { // Display the update fragment FileUpdateFragment updateFragment = new FileUpdateFragment(); FragmentManager fragmentManager = getFragmentManager(); android.app.FragmentTransaction ft = fragmentManager.beginTransaction(); ft.replace(R.id.file_detail_container, updateFragment, UPDATE_FRAGMENT_STACK_STATE); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE); ft.addToBackStack(UPDATE_FRAGMENT_STACK_STATE); ft.commit();//w ww.j a va 2 s . co m }
From source file:com.ariesmcrae.eskwela.celebtweet.MainActivity.java
/** Add FeedFragment to Activity */ private FeedFragment addFeedFragment() { FeedFragment feedFragment;/*www . j av a 2s . co m*/ feedFragment = new FeedFragment(); FragmentTransaction transaction = mFragmentManager.beginTransaction(); transaction.replace(R.id.fragment_container, feedFragment); transaction.addToBackStack(null); transaction.commit(); mFragmentManager.executePendingTransactions(); return feedFragment; }
From source file:com.andreykaraman.multinote.ui.list.AltNoteActivity.java
void showAboutDialog() { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag("aboutDialog"); if (prev != null) { ft.remove(prev);/*from ww w .j av a2 s . co m*/ } ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = AboutDialogFragment.newInstance(); newFragment.show(ft, "aboutDialog"); }
From source file:jsettlers.main.android.JsettlersActivity.java
public void showFragment(JsettlersFragment fragment) { FragmentManager manager = getFragmentManager(); if (!fragment.shouldAddToBackStack()) { manager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); }/*w ww . j a va2 s . com*/ FragmentTransaction transaction = manager.beginTransaction(); if (fragment.shouldAddToBackStack()) { transaction.addToBackStack(fragment.getName()); } transaction.replace(R.id.base_menu, fragment); transaction.commit(); }
From source file:it.mobistego.MainActivity.java
@Override public void onMainFragmentGridItemSelected(MobiStegoItem mobiStegoItem) { if (mobiStegoItem != null) { ItemViewFragment viewFragment = new ItemViewFragment(); Bundle args = new Bundle(); viewFragment.setArguments(args); viewFragment.setMobiStegoItem(mobiStegoItem); FragmentTransaction transaction = getFragmentManager().beginTransaction(); Fragment mainFrag = getFragmentManager().findFragmentByTag(Constants.CONTAINER); transaction.replace(mainFrag.getId(), viewFragment); transaction.addToBackStack(null); transaction.commit();/*from w w w . j a v a 2s . co m*/ } }
From source file:com.google.android.apps.forscience.whistlepunk.LicenseActivity.java
private void showLicense(License license) { FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.add(R.id.container, LicenseFragment.newInstance(license), "license"); ft.addToBackStack(license.key); ft.commit();/*from www . j av a 2 s . c om*/ }
From source file:rtdc.android.presenter.MainActivity.java
public void goToFragment(FragmentType type) { User sessionUser = (User) Cache.getInstance().get("sessionUser"); switch (type) { case CAPACITY_OVERVIEW: fragment = new CapacityOverviewFragment(); if (sessionUser.getPermission().equals(User.Permission.MANAGER)) isAtHome = true;/*from w w w . ja va 2s . c om*/ break; case ACTION_PLAN: fragment = new ActionPlanFragment(); if (sessionUser.getPermission().equals(User.Permission.USER)) isAtHome = true; break; case MESSAGES: fragment = new MessagesFragment(); break; case MANAGE_UNITS: if (sessionUser.getPermission().equals(User.Permission.MANAGER)) isAtHome = true; fragment = new ManageUnitsFragment(); break; case MANAGE_USERS: fragment = new ManageUsersFragment(); break; case PROFILE: fragment = new ProfileFragment(); break; } // Insert the fragment by replacing any existing fragment FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.main_fragment_wrapper, fragment); transaction.addToBackStack(null); transaction.commit(); }