List of usage examples for android.support.v4.app FragmentTransaction remove
public abstract FragmentTransaction remove(Fragment fragment);
From source file:net.reichholf.dreamdroid.fragment.helper.FragmentHelper.java
public void finish(int resultCode, Intent data) { MultiPaneHandler mph = ((IMutliPaneContent) mFragment).getMultiPaneHandler(); if (mph.isMultiPane()) { boolean explicitShow = false; FragmentManager fm = getAppCompatActivity().getSupportFragmentManager(); if (fm.getBackStackEntryCount() > 0) { fm.popBackStackImmediate();// ww w. j av a 2 s. c om } else { explicitShow = true; } Fragment target = mFragment.getTargetFragment(); if (target != null) { if (resultCode != Statics.RESULT_NONE || data != null) { if (explicitShow) { FragmentTransaction ft = getAppCompatActivity().getSupportFragmentManager() .beginTransaction(); ft.remove(mFragment); ft.commit(); mph.showDetails(target); } target.onActivityResult(mFragment.getTargetRequestCode(), resultCode, data); } } } else { getAppCompatActivity().setResult(resultCode, data); getAppCompatActivity().finish(); } }
From source file:de.atomfrede.android.scc.MainActivity.java
@OptionsItem(R.id.menu_about) public void showAboutMenu() { FragmentTransaction ft = getSupportFragmentManager().beginTransaction(); Fragment prev = getSupportFragmentManager().findFragmentByTag("about_dialog"); if (prev != null) { ft.remove(prev); }// w w w . j a v a 2 s . c o m ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = AboutDialogFragment.newInstance(); newFragment.show(ft, "about_dialog"); }
From source file:com.mylovemhz.muse.MainActivity.java
private void hideMediaControls() { if (!isFinishing()) { FragmentManager fragmentManager = getSupportFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.remove(mediaControlFragment); transaction.commit();/*from w ww . ja v a 2 s.c o m*/ } }
From source file:com.xargsgrep.portknocker.asynctask.KnockerAsyncTask.java
@Override protected void onPreExecute() { FragmentManager fragmentManager = activity.getSupportFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); Fragment prev = fragmentManager.findFragmentByTag(ProgressDialogFragment.TAG); if (prev != null) ft.remove(prev); ft.addToBackStack(null);//w ww . jav a 2 s .c om ProgressDialogFragment dialogFragment = ProgressDialogFragment.newInstance(this, activity.getString(R.string.progress_dialog_sending_packets), false, ProgressDialog.STYLE_HORIZONTAL, progressMax); dialogFragment.setCancelable(true); dialogFragment.show(ft, ProgressDialogFragment.TAG); }
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 2s . co m }
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(); }// ww w . j a v a2 s . c om }
From source file:com.microsoft.rightsmanagement.ui.widget.TemplateDescriptorPickerFragment.java
/** * removes child fragments/*from w w w. j ava 2 s . c om*/ */ public void removeChildFragments() { if (mTemplatesFragment != null) { FragmentManager childFragmentManager = getChildFragmentManager(); FragmentTransaction ft = childFragmentManager.beginTransaction(); ft.setCustomAnimations(0, R.animator.slide_animation_out); ft.remove(mTemplatesFragment).commit(); mTemplatesFragment = null; } }
From source file:me.henrytao.sample.activity.MainActivity.java
protected boolean onOptionsItemSelected(@IdRes int id) { Fragment fragment = null;// w ww .j a v a 2s .c o m switch (id) { case R.id.action_info: setTitle(getString(R.string.text_info)); fragment = InfoFragment.newInstance(); break; case R.id.action_simple_recyclerview: setTitle(R.string.text_simple_recyclerview); fragment = SimpleRecyclerViewFragment.newInstance(); break; case R.id.action_material_recyclerview: setTitle(R.string.text_material_recyclerview); fragment = MaterialRecyclerViewFragment.newInstance(); break; case R.id.action_header_recyclerview: setTitle(R.string.text_header_recyclerview); fragment = HeaderRecyclerViewFragment.newInstance(); break; case R.id.action_header_footer_recyclerview: setTitle(R.string.text_header_footer_recyclerview); fragment = HeaderFooterRecyclerViewFragment.newInstance(); break; case R.id.action_multiple_header_recyclerview: setTitle(R.string.text_multiple_header_recyclerview); fragment = MultipleHeaderRecyclerViewFragment.newInstance(); break; case R.id.action_multi_state_recyclerview: setTitle(R.string.text_multi_state_recyclerview); fragment = MultiStateRecyclerViewFragment.newInstance(); break; case R.id.action_endless_recyclerview: setTitle(R.string.text_endless_recyclerview); fragment = EndlessRecyclerViewFragment.newInstance(); break; case R.id.action_header_grid_recyclerview: setTitle(R.string.text_header_grid_recyclerview); fragment = HeaderGridRecyclerViewFragment.newInstance(); break; case R.id.action_merge_adapter: setTitle(R.string.text_merge_adapter_recyclerview); fragment = MergeAdapterRecyclerViewFragment.newInstance(); } if (fragment != null) { FragmentTransaction transaction = getSupportFragmentManager().beginTransaction(); if (mFragment != null) { transaction = transaction.remove(mFragment); } transaction.replace(R.id.fragment, fragment).commit(); mFragment = fragment; } return false; }
From source file:it.sasabz.android.sasabus.fragments.BacinoFragment.java
@Override public void onItemClick(AdapterView<?> adapterview, View v, int position, long id) { int bacino = list.get(position).getId(); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); Fragment fragment = fragmentManager.findFragmentById(R.id.onlinefragment); if (fragment != null) { ft.remove(fragment); }/*from www. j a va 2 s . c o m*/ fragment = new LineaFragment(bacino); ft.add(R.id.onlinefragment, fragment); ft.addToBackStack(null); ft.commit(); fragmentManager.executePendingTransactions(); }
From source file:com.senior.fragments.GoogleFragment.java
@Override public void onDestroyView() { Log.i("Google", "Destroy view called"); super.onDestroyView(); try {//from w ww .j ava 2s . c o m Log.i("Google", "Destroy executing"); Fragment frag = (getFragmentManager().findFragmentById(R.id.google_map)); FragmentTransaction ft = getActivity().getSupportFragmentManager().beginTransaction(); ft.remove(frag); ft.commit(); } catch (Exception e) { Log.i("Google", "Error in destroying map " + e); } Log.i("Google", "On destroy complete!"); }