List of usage examples for android.app FragmentTransaction commit
public abstract int commit();
From source file:com.royclarkson.springagram.MainActivity.java
@Override public void onPhotoSelected(int position) { PhotoDetailFragment photoDetailFragment = PhotoDetailFragment.newInstance(position); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction() .add(R.id.container, photoDetailFragment).addToBackStack(null); transaction.commit(); }
From source file:com.royclarkson.springagram.MainActivity.java
@Override public void onGalleryPhotoSelected(int position) { PhotoDetailFragment photoDetailFragment = PhotoDetailFragment.newInstance(position); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction() .add(R.id.container, photoDetailFragment).addToBackStack(null); transaction.commit(); }
From source file:com.amaze.filemanager.activities.Preferences.java
public void selectItem(int i) { switch (i) {/*from www.j a v a 2 s. c o m*/ case 0: p = new Preffrag(); FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.prefsfragment, p); transaction.commit(); select = 0; getSupportActionBar().setTitle(R.string.setting); break; case 1: FragmentTransaction transaction1 = getFragmentManager().beginTransaction(); transaction1.replace(R.id.prefsfragment, new ColorPref()); transaction1.commit(); select = 1; getSupportActionBar().setTitle(R.string.color_title); break; } }
From source file:com.optimusinfo.elasticpath.cortex.common.EPFragmentActivity.java
protected void addFragment(String title, int fargmentContainerId, EPFragment objFragment) { mStackLevel++;// w ww .j av a2s.c o m // Add the fragment to the activity, pushing this transaction // on to the back stack. FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.setBreadCrumbTitle(title); ft.add(fargmentContainerId, objFragment); ft.commit(); }
From source file:com.ttarn.followme.ContactDetailActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { if (BuildConfig.DEBUG) { // Enable strict mode checks when in debug modes Utils.enableStrictMode();//from w ww. j ava 2 s.c o m } super.onCreate(savedInstanceState); // This activity expects to receive an intent that contains the uri of a contact if (getIntent() != null) { // For OS versions honeycomb and higher use action bar if (Utils.hasHoneycomb()) { // Enables action bar "up" navigation //getActionBar().setDisplayHomeAsUpEnabled(true); } // Fetch the data Uri from the intent provided to this activity final Uri uri = getIntent().getData(); // Checks to see if fragment has already been added, otherwise adds a new // ContactDetailFragment with the Uri provided in the intent if (getFragmentManager().findFragmentByTag(TAG) == null) { final FragmentTransaction ft = getFragmentManager().beginTransaction(); // Adds a newly created ContactDetailFragment that is instantiated with the // data Uri ft.add(android.R.id.content, ContactDetailFragment.newInstance(uri), TAG); //ft.show(ContactDetailFragment.newInstance(uri)).addToBackStack(null).commit(); ft.commit(); } } else { // No intent provided, nothing to do so finish() finish(); } }
From source file:com.royclarkson.springagram.MainActivity.java
@Override public void onGallerySelected(int position) { GalleryResource gallery = this.galleries.get(position); String url = gallery.getLink(GalleryResource.REL_ITEMS).getHref(); GalleryPhotoListFragment galleryPhotoListFragment = GalleryPhotoListFragment.newInstance(url); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction() .add(R.id.container, galleryPhotoListFragment).addToBackStack(null); transaction.commit(); }
From source file:rtdc.android.presenter.InCallActivity.java
public void displayVideo() { FragmentTransaction transaction = getFragmentManager().beginTransaction(); callFragment = new VideoCallFragment(); transaction.replace(R.id.in_call_fragment_wrapper, callFragment); transaction.addToBackStack(null);// w w w . j ava2 s . c om transaction.commit(); }
From source file:com.royclarkson.springagram.MainActivity.java
@Override public void onPhotoAddToGallerySelected(int position) { ItemResource item = this.photos.get(position); String itemGalleryUrl = item.getLink(ItemResource.REL_GALLERY).getHref(); PhotoAddToGalleryFragment photoAddToGalleryFragment = PhotoAddToGalleryFragment.newInstance(itemGalleryUrl); FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction transaction = fragmentManager.beginTransaction() .add(R.id.container, photoAddToGalleryFragment).addToBackStack(null); transaction.commit(); }
From source file:rtdc.android.presenter.InCallActivity.java
public void displayAudio() { if (AndroidVoipController.get().isVideoEnabled()) AndroidVoipController.get().setVideo(false); FragmentTransaction transaction = getFragmentManager().beginTransaction(); callFragment = new AudioCallFragment(); transaction.replace(R.id.in_call_fragment_wrapper, callFragment); transaction.addToBackStack(null);/*from www. j a v a2s.com*/ transaction.commit(); }
From source file:com.bradbergeron.splitviewcontrollerdemo.activities.MainActivity.java
@Override public void onDrawerItemSelected(final DrawerFragment.FragmentDrawerItem fragmentDrawerItem) { if (mDrawerLayout.isDrawerOpen(Gravity.START)) { mDrawerLayout.closeDrawer(Gravity.START); }//w w w. ja v a 2 s. co m final FragmentManager fragmentManager = getFragmentManager(); final String fragmentClassName = fragmentDrawerItem.getFragmentClass().getName(); Fragment newFragment = fragmentManager.findFragmentByTag(fragmentClassName); if (newFragment == null) { newFragment = Fragment.instantiate(this, fragmentClassName); } else if (newFragment.isAdded()) { return; } else if (fragmentDrawerItem.isDefaultItem() && fragmentManager.getBackStackEntryCount() > 0) { fragmentManager.popBackStack("Drawer", FragmentManager.POP_BACK_STACK_INCLUSIVE); } final FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.content, newFragment, fragmentClassName); if (!fragmentDrawerItem.isDefaultItem()) { transaction.addToBackStack("Drawer"); } transaction.commit(); }