List of usage examples for android.app FragmentTransaction replace
public abstract FragmentTransaction replace(@IdRes int containerViewId, Fragment fragment, String tag);
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void showNetstatFragment() { FragmentTransaction ft; ft = fm.beginTransaction();//from w ww . j av a2s. c o m final Fragment fragment = new NetstatFragment(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_NETSTAT); ft.addToBackStack(AppConstants.PAGE_TITLE_NETSTAT); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_NETSTAT); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * /* w ww. j a v a 2s .c o m*/ */ public void showSync() { FragmentTransaction ft; ft = fm.beginTransaction(); final Fragment fragment = new RMBTSyncFragment(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_SYNC); ft.addToBackStack(AppConstants.PAGE_TITLE_SYNC); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_SYNC); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void showFilter() { final FragmentManager fm = getFragmentManager(); FragmentTransaction ft; final Fragment fragment = new RMBTFilterFragment(); ft = fm.beginTransaction();/*from w ww.j av a 2s.c o m*/ ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_HISTORY_FILTER); ft.addToBackStack(AppConstants.PAGE_TITLE_HISTORY_FILTER); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_HISTORY_FILTER); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * // w ww .j a v a2 s .c om * @param popStack */ public void startTest(final boolean popStack) { if (networkInfoCollector != null) { if (!networkInfoCollector.hasConnectionFromAndroidApi()) { showNoNetworkConnectionToast(); return; } } final boolean loopMode = ConfigHelper.isLoopMode(this); if (loopMode) { startService(new Intent(this, RMBTLoopService.class)); } else { FragmentTransaction ft; ft = fm.beginTransaction(); final RMBTTestFragment rmbtTestFragment = new RMBTTestFragment(); ft.replace(R.id.fragment_content, rmbtTestFragment, AppConstants.PAGE_TITLE_TEST); ft.addToBackStack(AppConstants.PAGE_TITLE_TEST); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); if (popStack) fm.popBackStack(); ft.commit(); final Intent service = new Intent(RMBTService.ACTION_START_TEST, null, this, RMBTService.class); startService(service); } }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
public void showHelp(final String url, boolean popBackStack, String titleId) { if (popBackStack) { popBackStackFull();//from ww w. jav a 2s . co m } FragmentTransaction ft; ft = fm.beginTransaction(); final Fragment fragment = new RMBTHelpFragment(); final Bundle args = new Bundle(); args.putString(RMBTHelpFragment.ARG_URL, url); fragment.setArguments(args); ft.replace(R.id.fragment_content, fragment, titleId); ft.addToBackStack(titleId); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(titleId); }
From source file:com.luke.lukef.lukeapp.MainActivity.java
/** * Switches the <code>fragment_container</code> RelativeLayout from <code>activity_main.xml</code> to the * fragment which is chosen./*w w w. j av a2s. com*/ * * @param fragmentToChange Constants enum type defined for each fragment * @param bundleToSend Optional bundle to send along with the transaction */ public void fragmentSwitcher(Constants.fragmentTypes fragmentToChange, Bundle bundleToSend) { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); Fragment fragment = null; String tag = "default"; // cases are enumerations, create new fragment corresponding with the enum given switch (fragmentToChange) { case FRAGMENT_LEADERBOARD: fragment = new LeaderboardFragment(); tag = "leader"; break; case FRAGMENT_NEW_SUBMISSION: fragment = new NewSubmissionFragment(); tag = "newSub"; break; case FRAGMENT_PROFILE: fragment = new ProfileFragment(); tag = "profile"; break; case FRAGMENT_MAP: fragment = new MapViewFragment(); tag = "map"; break; default: fragment = null; break; } //replace the fragment if (bundleToSend != null && fragment != null) { fragment.setArguments(bundleToSend); } if (fragment != null) { fragmentTransaction.replace(R.id.fragment_container, fragment, tag).addToBackStack(tag).commit(); } }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * /*from w ww . j a v a2s . c o m*/ * @param uid */ public void showResultDetail(final String testUUid) { FragmentTransaction ft; final Fragment fragment = new RMBTTestResultDetailFragment(); final Bundle args = new Bundle(); args.putString(RMBTTestResultDetailFragment.ARG_UID, testUUid); fragment.setArguments(args); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_RESULT_DETAIL); ft.addToBackStack(AppConstants.PAGE_TITLE_RESULT_DETAIL); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_RESULT_DETAIL); }
From source file:com.esri.android.mapsapp.MapFragment.java
/** * Opens the map represented by the specified portal item or if null, opens * a default map.//from w ww . j a va2s . co m */ public void showMap(String portalItemId, String basemapPortalItemId) { // remove existing MapFragment explicitly, simply replacing it can cause // the app to freeze when switching basemaps FragmentTransaction transaction; FragmentManager fragmentManager = getFragmentManager(); Fragment currentMapFragment = fragmentManager.findFragmentByTag(MapFragment.TAG); if (currentMapFragment != null) { transaction = fragmentManager.beginTransaction(); transaction.remove(currentMapFragment); transaction.commit(); } MapFragment mapFragment = MapFragment.newInstance(portalItemId, basemapPortalItemId); transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.maps_app_activity_content_frame, mapFragment, MapFragment.TAG); transaction.addToBackStack(null); transaction.commit(); getActivity().invalidateOptionsMenu(); // reload the options menu }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * // w ww . j a v a 2 s.c o m * @param uid */ public void showExpandedResultDetail(QoSServerResultCollection testResultArray, DetailType detailType, int position) { FragmentTransaction ft; //final RMBTResultDetailPagerFragment fragment = new RMBTResultDetailPagerFragment(); final QoSCategoryPagerFragment fragment = new QoSCategoryPagerFragment(); fragment.setQoSResult(testResultArray); fragment.setDetailType(detailType); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_RESULT_QOS); ft.addToBackStack("result_detail_expanded"); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); fragment.setCurrentPosition(position); refreshActionBar(AppConstants.PAGE_TITLE_RESULT_QOS); }
From source file:at.alladin.rmbt.android.main.RMBTMainActivity.java
/** * /* w w w .jav a 2 s. c om*/ * @param uid */ public void showQoSTestDetails(List<QoSServerResult> resultList, List<QoSServerResultDesc> descList, int index) { FragmentTransaction ft; //final RMBTResultDetailPagerFragment fragment = new RMBTResultDetailPagerFragment(); final QoSTestDetailPagerFragment fragment = new QoSTestDetailPagerFragment(); fragment.setQoSResultList(resultList); fragment.setQoSDescList(descList); fragment.setInitPosition(index); ft = fm.beginTransaction(); ft.replace(R.id.fragment_content, fragment, AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); ft.addToBackStack(AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); ft.setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN); ft.commit(); refreshActionBar(AppConstants.PAGE_TITLE_TEST_DETAIL_QOS); }