List of usage examples for android.app FragmentManager popBackStack
public abstract void popBackStack();
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();/* w w w .j a va 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: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();/*from 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:com.polarion.starter.MainActivity.java
public void popBackStack() { FragmentManager fragmentManager = getFragmentManager(); fragmentManager.popBackStack(); DrawerItem drawerItem = mDrawerAdapter.getItem(mPreviousPosition); if (mToolbar != null && drawerItem != null) { mToolbar.setTitle(drawerItem.title); }/*from w w w . j ava 2 s . com*/ }
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();/*from w w w. j av a 2s .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:it.scoppelletti.mobilepower.app.AbstractActivity.java
/** * Ripristina la configurazione dei frammenti iniziale. *///w ww . 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: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();/*www.ja v a2 s. c om*/ 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.sage42.androidappaddicts.app.main.MainActivity.java
/** * Show the previous fragment which is stored in the fragment transaction. * /*from www .j av a 2s. c o m*/ * @return */ protected boolean getAvailableBackStack() { final FragmentManager fragmentManager = this.getFragmentManager(); // check the fragmentManager and show the previous fragment if (fragmentManager.getBackStackEntryCount() != 0) { fragmentManager.popBackStack(); this.getActionBar().setDisplayHomeAsUpEnabled(true); if (fragmentManager.getBackStackEntryCount() == 1) { this.mDrawerToggle.syncState(); } return true; } return false; }
From source file:com.pepabo.jodo.jodoroid.MainActivity.java
@Override public void onBackPressed() { if (mDrawerLayout.isDrawerOpen(mDrawer)) { mDrawerLayout.closeDrawer(mDrawer); return;/*from w ww . j a v a2s . co m*/ } final FragmentManager fragmentManager = getFragmentManager(); if (fragmentManager.getBackStackEntryCount() > 1) { fragmentManager.popBackStack(); return; } super.onBackPressed(); }
From source file:us.cboyd.android.dicom.DcmBrowser.java
@Override public void onBackPressed() { File temp = mListFragment.getDir(); if (!mListFragment.isVisible()) { // Assume we're jumping back to the ListFragment if (ExternalIO.isRoot(temp)) { ActionBar actionBar = getActionBar(); actionBar.setHomeButtonEnabled(false); actionBar.setDisplayHomeAsUpEnabled(false); }/*w w w . j a v a 2 s. c om*/ FragmentManager fm = getFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStack(); } else { super.onBackPressed(); } // If the directory is the external storage directory or there is no parent, // super.onBackPressed(). Else go to parent directory. } else if (ExternalIO.isRoot(temp)) { super.onBackPressed(); } else { temp = temp.getParentFile(); mListFragment.setDir(temp); } onDirectorySelected(temp); }
From source file:com.murati.oszk.audiobook.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();/* w w w .j av a 2s.c o m*/ return; } String mediaId = null; if (this.getClass() == MusicPlayerActivity.class) { MusicPlayerActivity musicPlayerActivity = (MusicPlayerActivity) this; mediaId = musicPlayerActivity.getMediaId(); if (mediaId != null && mediaId.startsWith(MediaIDHelper.MEDIA_ID_BY_SEARCH)) { Intent home = new Intent(ActionBarCastActivity.this, MusicPlayerActivity.class); home.setAction(Intent.ACTION_VIEW); home.putExtra(MediaIDHelper.EXTRA_MEDIA_ID_KEY, MediaIDHelper.MEDIA_ID_ROOT); startActivity(home); 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(); } }