List of usage examples for android.app FragmentTransaction remove
public abstract FragmentTransaction remove(Fragment fragment);
From source file:com.mobile.syslogng.monitor.MainActivity.java
private void popBackFragment(String removalFragmentTag) { Fragment currentFragment = getFragmentManager().findFragmentById(R.id.container); if (currentFragment.getTag().equals(getFragmentManager() .getBackStackEntryAt(getFragmentManager().getBackStackEntryCount() - 1).getName())) { getFragmentManager().popBackStack(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.remove(currentFragment).commit(); getFragmentManager().executePendingTransactions(); }/* ww w . j a va 2 s. c o m*/ getFragmentManager().popBackStack(); Fragment removalFragment = getFragmentManager().findFragmentByTag(removalFragmentTag); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.remove(removalFragment).commit(); getFragmentManager().executePendingTransactions(); }
From source file:com.example.leonid.chatzilla.MainActivity.java
@Override public void onBackPressed() { FragmentTransaction ft = getFragmentManager().beginTransaction(); if (getFragmentManager().findFragmentByTag("list") != null && getFragmentManager().findFragmentByTag("chat") != null) { getFragmentManager().findFragmentByTag("list"); ft.remove(getFragmentManager().findFragmentByTag("chat")); ft.show(getFragmentManager().findFragmentByTag("list")).commit(); } else {//from w w w . j a v a2 s . c o m System.exit(0); } }
From source file:com.andreykaraman.multinote.ui.list.AltNoteActivity.java
void showAboutDialog() { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag("aboutDialog"); if (prev != null) { ft.remove(prev); }//from w w w.ja va 2 s .co m ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = AboutDialogFragment.newInstance(); newFragment.show(ft, "aboutDialog"); }
From source file:org.worshipsongs.activity.CustomYoutubeBoxActivity.java
private void setYouTubePlayerFragment() { YouTubePlayerFragment youTubePlayerFragment = YouTubePlayerFragment.newInstance(); youTubePlayerFragment.initialize("AIzaSyB7hLcRMs5KPZwElJnHBPK5DNmDqFxVy3s", this); FragmentTransaction transaction = getFragmentManager().beginTransaction(); if (isLandScape()) { transaction.remove(youTubePlayerFragment).commit(); } else {// w w w . j a v a 2 s . c om transaction.add(R.id.youtube_fragment, youTubePlayerFragment).commit(); } }
From source file:com.smassive.comicviewr.app.view.activity.MainActivity.java
@Override protected void onSaveInstanceState(Bundle outState) { if (twoPanel) { FragmentTransaction fragmentTransaction = this.getFragmentManager().beginTransaction(); Fragment detailFragment = getFragmentManager().findFragmentByTag(DETAIL_FRAGMENT); if (detailFragment != null) { fragmentTransaction.remove(detailFragment); }/*w ww . j a v a 2s . co m*/ fragmentTransaction.commit(); } super.onSaveInstanceState(outState); }
From source file:com.dono.psakkos.dono.MainActivity.java
private void removeAllFragments() { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); LonelyFragment lonelyFragment = new LonelyFragment(); fragmentTransaction.remove(lonelyFragment); LabelsFragment labelsFragment = new LabelsFragment(); fragmentTransaction.remove(labelsFragment); AddLabelFragment addlabelFragment = new AddLabelFragment(); fragmentTransaction.remove(addlabelFragment); KeyFragment keyFragment = new KeyFragment(); fragmentTransaction.remove(keyFragment); fragmentTransaction.commit();// ww w .j a v a 2 s . c o m }
From source file:com.android.calendar.SearchActivity.java
private void deleteEvent(long eventId, long startMillis, long endMillis) { mDeleteEventHelper.delete(startMillis, endMillis, eventId, -1); if (mIsMultipane && mEventInfoFragment != null && eventId == mCurrentEventId) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); ft.remove(mEventInfoFragment); ft.commit();//from w w w .jav a 2 s . c om mEventInfoFragment = null; mCurrentEventId = -1; } }
From source file:com.kevinshen.beyondupnp.ui.MainActivity.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_select) { FragmentTransaction ft = getFragmentManager().beginTransaction(); Fragment prev = getFragmentManager().findFragmentByTag(DIALOG_FRAGMENT_TAG); if (prev != null) { ft.remove(prev); }// w w w.j a v a 2 s.c om ft.addToBackStack(null); // Create and show the dialog. DialogFragment newFragment = DeviceListDialogFragment.newInstance(); newFragment.show(ft, DIALOG_FRAGMENT_TAG); } return super.onOptionsItemSelected(item); }
From source file:systems.soapbox.ombuds.client.ui.AddressBookActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.address_book_content); setSupportActionBar((Toolbar) findViewById(R.id.toolbar)); getSupportActionBar().setDisplayHomeAsUpEnabled(true); super.setAnimateOnPause(true); final FragmentManager fragmentManager = getFragmentManager(); walletAddressesFragment = (WalletAddressesFragment) fragmentManager.findFragmentByTag(TAG_LEFT); sendingAddressesFragment = (SendingAddressesFragment) fragmentManager.findFragmentByTag(TAG_RIGHT); final FragmentTransaction removal = fragmentManager.beginTransaction(); if (walletAddressesFragment == null) walletAddressesFragment = new WalletAddressesFragment(); else//from ww w. ja v a 2s . co m removal.remove(walletAddressesFragment); if (sendingAddressesFragment == null) sendingAddressesFragment = new SendingAddressesFragment(); else removal.remove(sendingAddressesFragment); if (!removal.isEmpty()) { removal.commit(); fragmentManager.executePendingTransactions(); } final ViewPager pager = (ViewPager) findViewById(R.id.address_book_pager); if (pager != null) { pager.setAdapter( new TwoFragmentAdapter(fragmentManager, walletAddressesFragment, sendingAddressesFragment)); final ViewPagerTabs pagerTabs = (ViewPagerTabs) findViewById(R.id.address_book_pager_tabs); pagerTabs.addTabLabels(R.string.address_book_list_receiving_title, R.string.address_book_list_sending_title); pager.setOnPageChangeListener(pagerTabs); final int position = 1; pager.setCurrentItem(position); pager.setPageMargin(2); pager.setPageMarginDrawable(R.color.bg_less_bright); pagerTabs.onPageSelected(position); pagerTabs.onPageScrolled(position, 0, 0); } else { fragmentManager.beginTransaction() .add(R.id.wallet_addresses_fragment, walletAddressesFragment, TAG_LEFT) .add(R.id.sending_addresses_fragment, sendingAddressesFragment, TAG_RIGHT).commit(); } updateFragments(); }