List of usage examples for android.app FragmentTransaction replace
public abstract FragmentTransaction replace(@IdRes int containerViewId, Fragment fragment);
From source file:org.mariotaku.twidere.activity.support.BrowserActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { supportRequestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS); supportRequestWindowFeature(WindowCompat.FEATURE_ACTION_BAR); super.onCreate(savedInstanceState); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); }/*w w w . ja v a 2 s . co m*/ mUri = getIntent().getData(); if (mUri == null) { Toast.makeText(this, R.string.error_occurred, Toast.LENGTH_SHORT).show(); finish(); return; } final FragmentTransaction ft = getFragmentManager().beginTransaction(); final Fragment fragment = Fragment.instantiate(this, BaseWebViewFragment.class.getName()); final Bundle bundle = new Bundle(); bundle.putString(EXTRA_URI, mUri.toString()); fragment.setArguments(bundle); ft.replace(android.R.id.content, fragment); ft.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);//from www. j a v a 2 s. c o m transaction.commit(); }
From source file:com.sage42.androidappaddicts.app.main.MainActivity.java
public void showFragment(final Fragment fragment, final boolean addToBackstack) { final FragmentManager fragmentManager = this.getFragmentManager(); final FragmentTransaction transaction = fragmentManager.beginTransaction(); transaction.replace(R.id.main_content_fragment, fragment); if (addToBackstack) { transaction.addToBackStack(null); } else {/*w w w . j a va 2s . c o m*/ this.clearAllBackStack(); this.mDrawerToggle.syncState(); } transaction.commit(); // close the drawer this.mDrawerLayout.closeDrawer(this.mMenuDrawerList); }
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);/* w w w. jav a 2 s.c o m*/ transaction.commit(); }
From source file:org.dolphinemu.dolphinemu.gamelist.GameListActivity.java
/** * Switches to the {@link Fragment} represented * by the given ID number./*w w w .ja v a 2s.c o m*/ * * @param toPage the number representing the {@link Fragment} to switch to. */ public void SwitchPage(int toPage) { if (mCurFragmentNum == toPage) return; switch (toPage) { case 0: // Game list { // We use the title section as the browser directory tracker in the folder browser. // Make sure we flip the title back if we're coming from that fragment. if (mCurFragmentNum == 1) setTitle(R.string.app_name); mCurFragmentNum = 0; final GameListFragment gameList = new GameListFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, gameList); ft.commit(); invalidateOptionsMenu(); } break; case 1: // Folder Browser { mCurFragmentNum = 1; final FolderBrowser folderBrowser = new FolderBrowser(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.content_frame, folderBrowser); ft.addToBackStack(null); ft.commit(); invalidateOptionsMenu(); } break; case 2: // Settings { Intent intent = new Intent(this, PrefsActivity.class); startActivity(intent); } break; case 3: // About { Intent intent = new Intent(this, AboutActivity.class); startActivity(intent); } break; default: break; } }
From source file:com.hyung.jin.seo.getup.wear.G3tUpActivity.java
private void selectFragment() { fragment = null;/*from www . j a va 2 s . c o m*/ // If CounterFragment is about to display, trigger timer as well if (status == G3tUpConstants.COUNTER_STATE) { fragment = new CounterFragment(); CountDownTimer timer = new MyCountDownTimer(G3tUpConstants.SECOND * timerDuration * 60, G3tUpConstants.SECOND); timer.start(); // ExerciseFragment } else if (status == G3tUpConstants.EXERCISE_STATE) { fragment = new ExerciseFragment(); // DisplayFragment } else { fragment = new DisplayFragment(); } FragmentManager fm = getFragmentManager(); FragmentTransaction ftx = fm.beginTransaction(); ftx.replace(R.id.fragment_place, fragment); ftx.commit(); }
From source file:com.dono.psakkos.dono.MainActivity.java
private void showKeyFragment() { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); KeyFragment keyFragment = new KeyFragment(); fragmentTransaction.replace(R.id.mainFragment, keyFragment); fragmentTransaction.commit();/*w ww . j a va 2s .c om*/ }
From source file:com.android.messaging.ui.appsettings.PerSubscriptionSettingsActivity.java
@Override protected void onCreate(final Bundle savedInstanceState) { super.onCreate(savedInstanceState); getSupportActionBar().setDisplayHomeAsUpEnabled(true); final String title = getIntent().getStringExtra(UIIntents.UI_INTENT_EXTRA_PER_SUBSCRIPTION_SETTING_TITLE); if (!TextUtils.isEmpty(title)) { getSupportActionBar().setTitle(title); } else {//w ww . j a v a 2s. c o m // This will fall back to the default title, i.e. "Messaging settings," so No-op. } final FragmentTransaction ft = getFragmentManager().beginTransaction(); final PerSubscriptionSettingsFragment fragment = new PerSubscriptionSettingsFragment(); ft.replace(android.R.id.content, fragment); ft.commit(); }
From source file:com.dono.psakkos.dono.MainActivity.java
private void showLonelyFragment() { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); LonelyFragment lonelyFragment = new LonelyFragment(); fragmentTransaction.replace(R.id.mainFragment, lonelyFragment); fragmentTransaction.commit();/*from w w w . j av a 2 s. com*/ }
From source file:com.dono.psakkos.dono.MainActivity.java
private void showLabelsFragment() { FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction(); LabelsFragment labelsFragment = new LabelsFragment(); fragmentTransaction.replace(R.id.mainFragment, labelsFragment); fragmentTransaction.commit();/*www .j av a 2 s.com*/ }