List of usage examples for android.support.v4.app FragmentTransaction commitAllowingStateLoss
public abstract int commitAllowingStateLoss();
From source file:com.gudong.appkit.ui.activity.SearchActivity.java
private void initSearchContent() { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); mSearchResultFragment = AppListFragment.getInstance(3); fragmentTransaction.replace(R.id.fl_container, mSearchResultFragment); fragmentTransaction.commitAllowingStateLoss(); }
From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java
@Override public void onBackPressed() { if (!mAutoLogin) { super.onBackPressed(); } else {//from www. j a va 2s . c om // Create bundle to pass to the confirmation dialog. Bundle bundle = new Bundle(); bundle.putInt(DialogConfirmation.EXTRA_TITLE, R.string.txtCloseAppTitle); bundle.putInt(DialogConfirmation.EXTRA_MESSAGE, R.string.txtCloseAppMessage); bundle.putInt(DialogConfirmation.EXTRA_NEGATIVE, R.string.txtChangeUser); bundle.putInt(DialogConfirmation.EXTRA_POSITIVE, R.string.txtCloseApp); bundle.putInt(DialogConfirmation.EXTRA_NEUTRAL, R.string.txtCancel); // If progress dialog is already created reuse it. DialogConfirmation dialog = (DialogConfirmation) getSupportFragmentManager() .findFragmentByTag("confirmation"); if (dialog == null) dialog = new DialogConfirmation(); dialog.setCancelable(false); dialog.setArguments(bundle); // Start showing progress dialog fragment. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(dialog, "confirmation"); transaction.commitAllowingStateLoss(); } }
From source file:com.dm.wallpaper.board.activities.WallpaperBoardBrowserActivity.java
private void setFragment() { Fragment fragment = null;//w w w .jav a 2s . c o m if (mFragmentId == Extras.ID_CATEGORY_WALLPAPERS) { fragment = CategoryWallpapersFragment.newInstance(mCategoryName, mCategoryCount); } else if (mFragmentId == Extras.ID_WALLPAPER_SEARCH) { fragment = new WallpaperSearchFragment(); mFragmentTag = Extras.TAG_WALLPAPER_SEARCH; } if (fragment == null) { finish(); return; } FragmentTransaction ft = mFragManager.beginTransaction().replace(R.id.container, fragment, mFragmentTag); try { ft.commit(); } catch (Exception e) { ft.commitAllowingStateLoss(); } }
From source file:net.nightwhistler.pageturner.activity.CatalogActivity.java
private void hideDetailsView() { if (detailsFragment != null) { FragmentTransaction ft = fragmentManager.beginTransaction(); ft.hide(detailsFragment);//from ww w .j a v a 2 s . c o m ft.commitAllowingStateLoss(); } }
From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { // Handle action bar item clicks here. The action bar will // automatically handle clicks on the Home/Up button, so long // as you specify a parent activity in AndroidManifest.xml. int id = item.getItemId(); //noinspection SimplifiableIfStatement if (id == R.id.action_about_us) { AboutUsDialogFragment dialog = (AboutUsDialogFragment) getSupportFragmentManager() .findFragmentByTag("about_us_dialog"); if (dialog == null) dialog = new AboutUsDialogFragment(); dialog.setCancelable(false);/*from w w w . java2 s. com*/ // Start showing progress dialog fragment. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(dialog, "about_us_dialog"); transaction.commitAllowingStateLoss(); return true; } if (id == R.id.action_settings) { DialogSettings dialog = (DialogSettings) getSupportFragmentManager() .findFragmentByTag("settings_dialog"); if (dialog == null) dialog = new DialogSettings(); dialog.setCancelable(false); // Start showing progress dialog fragment. FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); transaction.add(dialog, "settings_dialog"); transaction.commitAllowingStateLoss(); return true; } return super.onOptionsItemSelected(item); }
From source file:com.kubotaku.android.code4kyoto5374.MainActivity.java
private void removeSelectHomeView() { final FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(HomeSelectFragment.TAG) != null) { final FragmentTransaction trans = fm.beginTransaction(); trans.remove(fm.findFragmentByTag(HomeSelectFragment.TAG)); trans.commitAllowingStateLoss(); }/*from w ww . ja v a 2 s.c om*/ }
From source file:com.gm.goldencity.activity.search.SearchActivity.java
private void attachFragments() { FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction(); fragmentTransaction.replace(R.id.search_fragment, searchFragment, TAG_SEARCH_FRAGMENT); fragmentTransaction.commitAllowingStateLoss(); }
From source file:com.anthony.app.common.widgets.fragmentNavigator.FragmentNavigator.java
/** * remove all fragment in the {@link FragmentManager} * * @param allowingStateLoss true if allowing state loss otherwise false *//* w w w.j a v a 2 s . com*/ public void removeAllFragment(boolean allowingStateLoss) { FragmentTransaction transaction = mFragmentManager.beginTransaction(); removeAll(transaction); if (allowingStateLoss) { transaction.commitAllowingStateLoss(); } else { transaction.commit(); } }
From source file:com.kubotaku.android.code4kyoto5374.MainActivity.java
private void removeGarbageDaysView() { final FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(GarbageCollectDaysFragment.TAG) != null) { final FragmentTransaction trans = fm.beginTransaction(); trans.remove(fm.findFragmentByTag(GarbageCollectDaysFragment.TAG)); trans.commitAllowingStateLoss(); }//from w w w.ja v a2 s . c o m }
From source file:com.flamingo.activity.FragmentBase.java
/** * Handles fragment transactions (switching between fragments). *//* w w w. jav a 2 s . c o m*/ private void navigate() { Fragment frag = new TimerFragment(); final FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); frag.setArguments(getIntent().getExtras()); transaction.replace(R.id.frag_holder, frag).addToBackStack("" + 0); transaction.setTransition(FragmentTransaction.TRANSIT_ENTER_MASK); transaction.commitAllowingStateLoss(); }