List of usage examples for android.app FragmentManager beginTransaction
public abstract FragmentTransaction beginTransaction();
From source file:com.yangtsaosoftware.pebblemessenger.activities.NavigationActivity.java
@Override public void onNavigationDrawerItemSelected(int position) { // update the main content by replacing fragments Constants.log(CLASS_TAG, "Navigation Item Selected:" + String.valueOf(position)); FragmentManager fragmentManager = getFragmentManager(); switch (position) { case 0://w w w .j av a 2 s . com fragmentManager.beginTransaction().replace(R.id.container, new SettingFragment()).commit(); break; case 1: fragmentManager.beginTransaction().replace(R.id.container, new SetupFragment()).commit(); break; case 2: fragmentManager.beginTransaction().replace(R.id.container, new ToolsFragment()).commit(); break; case 3: fragmentManager.beginTransaction().replace(R.id.container, new PlaceholderFragment()).commit(); break; } }
From source file:com.github.blalasaadri.sprinttopics.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment;/* w ww. j a v a 2s . c o m*/ Bundle args = new Bundle(); switch (navigationListIds[position]) { case "topics": fragment = new TopicsFragment(); break; case "new": fragment = new NurseryRhymeFragment(); args.putSerializable(NURSERY_RHYME_ARGUMENT, NEW); break; case "old": fragment = new NurseryRhymeFragment(); args.putSerializable(NURSERY_RHYME_ARGUMENT, OLD); break; case "licenses": fragment = new LicensesFragment(); break; default: // How did we land here? fragment = new ErrorFragment(); args.putInt(ERROR_MESSAGE_ARG, R.string.navigation_error); } fragment.setArguments(args); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(navigationListItems[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.app.opencity.activities.MainActivity.java
public void disconnectUser() { int position = mArray.getPosition("DashBoard"); mIsProfile = false;// www . jav a 2s. co m mPlanetTitles[mArray.getPosition("Profil")] = "Connexion"; mArray.notifyDataSetChanged(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .replace(R.id.content_frame, DashBoardFragment.newInstance(position)).commit(); mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); }
From source file:com.prashantb.customized_navigation_drawer.MainActivity.java
private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new PlanetFragment(); Bundle args = new Bundle(); args.putInt(PlanetFragment.ARG_PLANET_NUMBER, position); fragment.setArguments(args);//from w ww. j a va 2 s.com FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); mDrawerLayout.closeDrawer(mLinearLayout); }
From source file:br.edu.ufabc.padm.cardioufabc.MainActivity.java
public void iniciarMedicao(View view) { Fragment fragment = null;//from w w w.j a v a 2s .c o m fragment = new CriarAtividadeFragment(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).addToBackStack(null).commit(); }
From source file:com.app.opencity.activities.MainActivity.java
public void setProfile() { int position = mArray.getPosition("DashBoard"); mIsProfile = true;/* w w w . j av a 2 s .c o m*/ mPlanetTitles[mArray.getPosition("Connexion")] = "Profil"; mArray.notifyDataSetChanged(); FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN) .replace(R.id.content_frame, DashBoardFragment.newInstance(position)).commit(); mDrawerList.setItemChecked(position, true); setTitle(mPlanetTitles[position]); }
From source file:com.socprox.prealpha.LobbyActivity.java
private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new NavigationFragment(); Bundle args = new Bundle(); args.putInt(NavigationFragment.ARG_NAVIGATION_NUMBER, position); fragment.setArguments(args);/*from w w w .j a va 2 s . c o m*/ FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mNavigationTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.ptr.foldingdrawerlayout.sample.FoldingDrawerLayoutActivity.java
private void selectItem(int position) { // update the main content by replacing fragments Fragment fragment = new AnimalFragment(); Bundle args = new Bundle(); args.putInt(AnimalFragment.ARG_ANIMAL_NUMBER, position); fragment.setArguments(args);/* ww w . java 2 s. co m*/ FragmentManager fragmentManager = getFragmentManager(); fragmentManager.beginTransaction().replace(R.id.content_frame, fragment).commit(); // update selected item and title, then close the drawer mDrawerList.setItemChecked(position, true); setTitle(mAnimalTitles[position]); mDrawerLayout.closeDrawer(mDrawerList); }
From source file:com.songnick.blogdemo.NetEaseDemo_Activity.java
private void addContentLayout() { FragmentManager fm = getFragmentManager(); FragmentTransaction ft = fm.beginTransaction(); ft.add(R.id.content_frame, new NetEaseDemo_Fragment()); ft.commitAllowingStateLoss();//from w ww . ja va 2 s .c om }
From source file:de.sourcestream.movieDB.controller.GalleryList.java
/** * Callback method to be invoked when an item in this AdapterView has been clicked. * * @param parent The AdapterView where the click happened. * @param view The view within the AdapterView that was clicked (this will be a view provided by the adapter) * @param position The position of the view in the adapter. * @param id The row id of the item that was clicked. *///w w w .j ava 2s. com @Override public void onItemClick(AdapterView<?> parent, View view, int position, long id) { FragmentManager manager = getFragmentManager(); FragmentTransaction transaction = manager.beginTransaction(); Bundle args = new Bundle(); args.putStringArrayList("galleryList", galleryPath); args.putInt("currPos", position); galleryPreview.setArguments(args); transaction.replace(R.id.frame_container, galleryPreview); // add the current transaction to the back stack: transaction.addToBackStack("galleryList"); transaction.commit(); }