List of usage examples for android.app FragmentManager getBackStackEntryCount
public abstract int getBackStackEntryCount();
From source file:com.sage42.androidappaddicts.app.main.MainActivity.java
/** * Remove all back stack to avoid missing flow on back pressed. *//*from w w w . j a va2 s. co m*/ private void clearAllBackStack() { final FragmentManager fragmentManager = this.getFragmentManager(); final int backStackCount = fragmentManager.getBackStackEntryCount(); for (int i = 0; i < backStackCount; i++) { // removing all the stored backstack final int backStackId = fragmentManager.getBackStackEntryAt(i).getId(); fragmentManager.popBackStack(backStackId, FragmentManager.POP_BACK_STACK_INCLUSIVE); } }
From source file:com.bayapps.android.robophish.ui.ActionBarCastActivity.java
@Override public void onBackPressed() { // If the drawer is open, back will close it if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawers();/*from w w w .j a v a2 s . com*/ return; } // Otherwise, it may return to the previous fragment stack FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); } else { // Lastly, it will rely on the system behavior for back super.onBackPressed(); } }
From source file:com.appdevper.mediaplayer.activity.ActionBarCastActivity.java
@Override public void onBackPressed() { // If the drawer is open, back will close it if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(Gravity.LEFT)) { mDrawerLayout.closeDrawers();/* www . j a v a2s. c o m*/ return; } // Otherwise, it may return to the previous fragment stack FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); } else { // Lastly, it will rely on the system behavior for back super.onBackPressed(); } }
From source file:com.chinaftw.music.ui.ActionBarCastActivity.java
@Override public void onBackPressed() { // If the drawer is open, back will close it if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(Gravity.START)) { mDrawerLayout.closeDrawers();/* ww w . j a v a 2 s . c o m*/ return; } // Otherwise, it may return to the previous fragment stack FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); } else { // Lastly, it will rely on the system behavior for back super.onBackPressed(); } }
From source file:de.jadehs.jadehsnavigator.MainActivity.java
@Override public void onBackPressed() { FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 1) { // jump to previous fragment fragmentManager.popBackStackImmediate(); FragmentManager.BackStackEntry entry = fragmentManager .getBackStackEntryAt(fragmentManager.getBackStackEntryCount() - 1); setTitle(entry.getName());/* w w w.ja v a 2 s . co m*/ } else { // quit the app super.onBackPressed(); } }
From source file:it.scoppelletti.mobilepower.app.AbstractActivity.java
/** * Ripristina la configurazione dei frammenti iniziale. *//* w w w . jav a 2s.c o m*/ protected final void backToHome() { int n; FragmentManager fragmentMgr = getSupportFragmentManager(); for (n = fragmentMgr.getBackStackEntryCount(); n > 0; n--) { fragmentMgr.popBackStack(); } }
From source file:org.steveleach.scoresheet.ui.ScoresheetActivity.java
public void closeLatestFragment() { FragmentManager fm = getFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStackImmediate();//from w w w .j a va 2 s . c om } }
From source file:org.steveleach.scoresheet.ui.ScoresheetActivity.java
@Override public void onBackPressed() { FragmentManager fm = getFragmentManager(); if (fm.getBackStackEntryCount() > 1) { closeLatestFragment();/*from w w w. jav a2 s .c o m*/ } else { super.onBackPressed(); } }
From source file:com.notriddle.budget.EnvelopesActivity.java
@Override public void onBackPressed() { FragmentManager fragmentManager = getFragmentManager(); if (mDrawerLayout.isDrawerOpen(mNavDrawer)) { mDrawerLayout.closeDrawers();//w w w. j a va2s. co m } else if (fragmentManager.getBackStackEntryCount() != 0) { fragmentManager.popBackStackImmediate(); configureFragment(fragmentManager.findFragmentById(R.id.content_frame)); } else { super.onBackPressed(); } }
From source file:com.misterpereira.android.kiteplayer.ui.ActionBarCastActivity.java
@Override public void onBackPressed() { // If the drawer is open, back will closeQuietly it if (mDrawerLayout != null && mDrawerLayout.isDrawerOpen(GravityCompat.START)) { mDrawerLayout.closeDrawers();/*from ww w . j a v a 2 s.com*/ return; } // Otherwise, it may return to the previous fragment stack FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack(); } else { // Lastly, it will rely on the system behavior for back super.onBackPressed(); } }