List of usage examples for android.support.v4.app FragmentTransaction commitAllowingStateLoss
public abstract int commitAllowingStateLoss();
From source file:com.ai.eve.lenovo.widget.FragmentTabHost.java
public void addTab(TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);/*from w w w .j a va 2 s . c om*/ ft.commitAllowingStateLoss(); } } mTabs.add(info); addTab(tabSpec); }
From source file:com.kubotaku.android.code4kyoto5374.MainActivity.java
private void showSelectHomeView(int mode) { final FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(HomeSelectFragment.TAG) == null) { final FragmentTransaction trans = fm.beginTransaction(); final HomeSelectFragment fragment = HomeSelectFragment.newInstance(mode); trans.add(R.id.view_holder, fragment, HomeSelectFragment.TAG); trans.commitAllowingStateLoss(); }//from w ww. j a va 2s .c o m }
From source file:com.scxrh.amb.widget.FragmentTabHostState.java
@Override public void onTabChanged(String tabId) { if (mAttached) { FragmentTransaction ft = doTabChanged(tabId, null); if (ft != null) { //ft.commit(); ft.commitAllowingStateLoss(); }//w w w. j a v a 2 s. com } if (mOnTabChangeListener != null) { mOnTabChangeListener.onTabChanged(tabId); } }
From source file:com.miqian.mq.views.FragmentTabHost.java
public void addTab(TabHost.TabSpec tabSpec, Class<?> clss, Bundle args) { tabSpec.setContent(new DummyTabFactory(mContext)); String tag = tabSpec.getTag(); TabInfo info = new TabInfo(tag, clss, args); if (mAttached) { // If we are already attached to the window, then check to make // sure this tab's fragment is inactive if it exists. This shouldn't // normally happen. info.fragment = mFragmentManager.findFragmentByTag(tag); if (info.fragment != null && !info.fragment.isDetached()) { FragmentTransaction ft = mFragmentManager.beginTransaction(); ft.detach(info.fragment);//from w ww . j a va2 s . co m ft.commitAllowingStateLoss(); } } mTabs.add(info); addTab(tabSpec); }
From source file:mobi.cangol.mobile.base.BaseDialogFragment.java
void dismissInternal(boolean allowStateLoss) { if (!this.mDismissed) { this.mDismissed = true; this.mShownByMe = false; if (this.mDialog != null) { this.mDialog.dismiss(); this.mDialog = null; }//from ww w. j ava 2 s .c o m this.mViewDestroyed = true; if (this.mBackStackId >= 0) { this.getFragmentManager().popBackStack(this.mBackStackId, 1); this.mBackStackId = -1; } else { FragmentTransaction ft = this.getFragmentManager().beginTransaction(); ft.remove(this); if (allowStateLoss) { ft.commitAllowingStateLoss(); } else { ft.commit(); } } } }
From source file:com.kubotaku.android.code4kyoto5374.MainActivity.java
private void showGarbageDaysView() { final FragmentManager fm = getSupportFragmentManager(); if (fm.findFragmentByTag(GarbageCollectDaysFragment.TAG) == null) { final FragmentTransaction trans = fm.beginTransaction(); final GarbageCollectDaysFragment fragment = GarbageCollectDaysFragment.newInstance(); trans.add(R.id.view_holder, fragment, GarbageCollectDaysFragment.TAG); trans.commitAllowingStateLoss(); }/*from w w w . j av a 2 s . c o m*/ }
From source file:com.seo.app.views.FragmentTabHost.java
@Override public void onTabChanged(String tabId) { if (mAttached) { FragmentTransaction ft = doTabChanged(tabId, null); if (ft != null) { ft.commitAllowingStateLoss(); //?? }//from ww w .j av a2s . co m } if (mOnTabChangeListener != null) { mOnTabChangeListener.onTabChanged(tabId); } }
From source file:org.totschnig.myexpenses.activity.ProtectionDelegate.java
public void removeAsyncTaskFragment(boolean keepProgress) { FragmentManager m = ((FragmentActivity) ctx).getSupportFragmentManager(); FragmentTransaction t = m.beginTransaction(); ProgressDialogFragment f = ((ProgressDialogFragment) m.findFragmentByTag(PROGRESS_TAG)); if (f != null) { if (keepProgress) { f.onTaskCompleted();// ww w . j ava 2s . co m } else { t.remove(f); } } t.remove(m.findFragmentByTag(ASYNC_TAG)); t.commitAllowingStateLoss(); //we might want to call a new task immediately after executing the last one m.executePendingTransactions(); }
From source file:org.computeforcancer.android.attach.CredentialInputActivity.java
public void openFragment(final AbstractBaseFragment fragment, final boolean addToStack) { closeKeyboard();/* w ww. j av a 2 s . c om*/ //mCurrentFragment = fragment; if (fragment instanceof SignInFragment) { Bundle arguments = new Bundle(); arguments.putString(SignInFragment.KEY_EMAIL, mEmail); arguments.putString(SignInFragment.KEY_NAME, mName); fragment.setArguments(arguments); } FragmentManager fm = getSupportFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.replace(R.id.cia_fragment_holder, fragment, fragment.getTAG()); if (addToStack) { ft.addToBackStack(fragment.getTAG()); } ft.commitAllowingStateLoss(); }
From source file:com.umeng.comm.ui.activities.BaseFragmentActivity.java
/** * @param container/*from w ww . j a va 2 s .c o m*/ * @param fragment */ public void replaceFragment(int container, Fragment fragment) { checkContainer(); if (mCurrentFragment != fragment) { FragmentTransaction transaction = mFragmentManager.beginTransaction(); transaction.replace(container, fragment, fragment.getClass().getSimpleName()); transaction.commitAllowingStateLoss(); mCurrentFragment = fragment; } }