List of usage examples for android.app FragmentManager popBackStack
public abstract void popBackStack(int id, int flags);
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
@Override public void onFileUpdateCancelled() { FragmentManager fm = getFragmentManager(); fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE, FragmentManager.POP_BACK_STACK_INCLUSIVE); }
From source file:com.microsoft.office365.starter.FilesFolders.FileDetailActivity.java
@Override public void onContentsUpdated(String updatedContent) { FragmentManager fm = getFragmentManager(); fm.popBackStack(UPDATE_FRAGMENT_STACK_STATE, FragmentManager.POP_BACK_STACK_INCLUSIVE); O365APIsStart_Application application = (O365APIsStart_Application) getApplication(); application.getDisplayedFile().setContents(FileDetailActivity.this, updatedContent); mDialog = ProgressDialogHelper.showProgressDialog(FileDetailActivity.this, "Updating file contents on server...", "Please wait."); application.getFileListViewState().setEventOperationCompleteListener(FileDetailActivity.this); application.getFileListViewState().postUpdatedFileContents(application, FileDetailActivity.this, application.getFileClient(), updatedContent); }
From source file:com.samebits.beacon.locator.ui.activity.BaseActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case android.R.id.home: FragmentManager fm = getFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); } else {/* ww w .java 2 s . c o m*/ finish(); } return true; case R.id.action_settings: launchSettingsActivity(); return true; case R.id.action_view_on_github: launchGitHubPage(); return true; case R.id.action_help: launchHelpPage(); return true; case R.id.action_donate: launchDonatePage(); return true; default: return super.onOptionsItemSelected(item); } }
From source file:com.notriddle.budget.EnvelopesActivity.java
public void topFragment(Class<?> cls, int transition, Bundle args) { Fragment frag = Fragment.instantiate(this, cls.getName(), args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, frag).setTransition(transition).commit(); fragmentManager.executePendingTransactions(); configureFragment(frag);//from w ww . j a v a 2 s .com }
From source file:edu.scranton.fisherc5.busybusy.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.findFragmentByTag("PRE_COMPARE") != null) { fragmentManager.popBackStack("PRE_COMPARE_PUSH", FragmentManager.POP_BACK_STACK_INCLUSIVE); }//from w w w . ja va 2 s .co m switch (position) { case 0: Fragment updateFrag = new UpdateFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, updateFrag).commit(); break; case 1: Fragment precompareFrag = new PreCompareFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, precompareFrag).commit(); break; case 3: Fragment updateActivityFrag = new UpdateUserActivityFragment(); fragmentManager.beginTransaction().replace(R.id.content_frame, updateActivityFrag).commit(); break; } // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mNavItems[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.sharedcab.batchcar.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments //dont add them to back stack as these are all main pages FragmentManager fragmentManager = getFragmentManager(); switch (position) { case 1:/*from w ww .j a va2s. c om*/ fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, bf).commit(); break; case 2: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, uf).commit(); break; case 3: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, prf).commit(); break; default: fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, mainFragment).commit(); break; } mDrawerList.setItemChecked(position, true); setTitle(mFrags[position]); mDrawerLayout.closeDrawer(mDrawerList); }
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); }/*from w w w . j a v a2 s . c o m*/ FragmentTransaction transaction = manager.beginTransaction(); if (fragment.shouldAddToBackStack()) { transaction.addToBackStack(fragment.getName()); } transaction.replace(R.id.base_menu, fragment); transaction.commit(); }
From source file:com.luorrak.ouroboros.thread.ThreadActivity.java
public void doPositiveClickInternal(String threadNo, String boardName) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); //clear dialog fragments fragmentManager.popBackStack("threadDialog", FragmentManager.POP_BACK_STACK_INCLUSIVE); if (!threadNo.equals("0")) { threadDepth = threadDepth + 1;/*from w w w .j a v a2s .c o m*/ threadFragment = new ThreadFragment().newInstance(threadNo, boardName); fragmentTransaction.replace(R.id.placeholder_card, threadFragment) .addToBackStack("threadDepth" + String.valueOf(threadDepth)).commit(); } else { Intent intent = new Intent(this, CatalogActivity.class); intent.putExtra(Util.INTENT_BOARD_NAME, boardName); startActivity(intent); } }
From source file:com.jainbooks.activitys.DashboardActivity.java
protected void executePendingTransactions() { if (pendingFragment == null) { return;//from w w w .j a v a 2s . co m } FragmentManager fragmentManager = getFragmentManager(); fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, pendingFragment).commit(); // update selected item and title, then close the drawer setTitle(mFragmentTitlesTitles[pendingPosition]); mDrawerLayout.closeDrawer(mDrawerList); mDrawerList.smoothScrollToPosition(0); }
From source file:com.jainbooks.activitys.DashboardActivity.java
public void selectItem(int position) { Fragment fragment = new EBookStoreFragment(); if (position == 0) { boolean isNetworkConnection = Utils.isNetworkAvailable(activity); Store store = ((App) getApplication()).getStore(); if (store != null || isNetworkConnection) { fragment = new EBookStoreFragment(); } else {/* www . j a v a 2s . c o m*/ fragment = new EBookNetworkHandlerFragment(); } } else if (position == 1) { fragment = new EBookMyLibraryFragment(); /* Uri uri = Uri.parse("file:///android_asset/and.pdf"); Intent intent = new Intent(this,MuPDFActivity.class); intent.setAction(Intent.ACTION_VIEW); intent.setData(uri); startActivity(intent); return;*/ } else if (position == 2) { fragment = new AccountFragment(); } FragmentManager fragmentManager = getFragmentManager(); fragmentManager.popBackStack(null, FragmentManager.POP_BACK_STACK_INCLUSIVE); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mFragmentTitlesTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); }