List of usage examples for android.app FragmentTransaction replace
public abstract FragmentTransaction replace(@IdRes int containerViewId, Fragment fragment);
From source file:tw.example.robert.myapplication.bluetoothchat.MainActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Intent intent = new Intent(this, LocationService.class); startService(intent);/* w ww. j ava 2 s. c o m*/ if (savedInstanceState == null) { FragmentManager ft = getFragmentManager(); FragmentTransaction transaction = ft.beginTransaction(); BluetoothChatFragment fragment = new BluetoothChatFragment(); transaction.replace(R.id.sample_content_fragment, fragment); transaction.commit(); } }
From source file:com.google.android.apps.forscience.whistlepunk.devicemanager.ManageDevicesActivity.java
private void setFragment() { BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); Fragment fragment;// w ww . j a v a2 s . c om if (adapter.isEnabled() && ScanDisabledFragment.hasScanPermission(this)) { mManageFragment = new ManageDevicesFragment(); fragment = mManageFragment; } else { fragment = new ScanDisabledFragment(); mManageFragment = null; } Bundle args = new Bundle(); args.putString(EXTRA_EXPERIMENT_ID, getIntent().getStringExtra(EXTRA_EXPERIMENT_ID)); fragment.setArguments(args); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fragment, fragment); ft.commitAllowingStateLoss(); }
From source file:com.tortel.deploytrack.SettingsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { // Check for light theme Prefs.load(this); if (Prefs.useLightTheme()) { setTheme(R.style.Theme_DeployThemeLight); }// w w w .j a v a 2s . c om super.onCreate(savedInstanceState); setContentView(R.layout.activity_settings); if (getSupportActionBar() != null) { getSupportActionBar().setDisplayHomeAsUpEnabled(true); } FragmentTransaction transaction = getFragmentManager().beginTransaction(); transaction.replace(R.id.content_frame, new SettingsFragment()); transaction.commit(); }
From source file:org.aakashlabs.arthashastra.Novice_Activity.java
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.fragment_container_N, fragment); }
From source file:org.aakashlabs.arthashastra.Advanced_Activity.java
@Override public void onTabSelected(Tab tab, FragmentTransaction ft) { ft.replace(R.id.fragment_container_A, fragment); }
From source file:com.dev.demo.activities.SlidingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sliding); if (savedInstanceState == null) { FragmentTransaction transaction = getFragmentManager().beginTransaction(); SlidingTabFragment fragment = new SlidingTabFragment(); transaction.replace(R.id.sample_content_fragment, fragment); transaction.commit();/*from w w w . j a v a 2s . c om*/ } configureToolbar(); configureDrawer(); }
From source file:com.harsh.androidclientphpbackend.fragment.ProfileFragment.java
private void goToLogin() { Fragment login = new LoginFragment(); FragmentTransaction ft = getFragmentManager().beginTransaction(); ft.replace(R.id.fragment_frame, login); ft.commit();//w ww . j av a2s . co m }
From source file:com.codejune.material.activities.SlidingActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_sliding); if (savedInstanceState == null) { FragmentTransaction transaction = getFragmentManager().beginTransaction(); SlidingTabsBasicFragment fragment = new SlidingTabsBasicFragment(); transaction.replace(R.id.sample_content_fragment, fragment); transaction.commit();/* w w w . ja va 2 s . c om*/ } configureToolbar(); configureDrawer(); }
From source file:com.albertcbraun.wifidlitedemoapp.MainActivity.java
@Override public void onNavigationDrawerItemSelected(int position) { Log.v(TAG, "onNavigationDrawerItemSelection. position:" + position); // update the main content by replacing fragments FragmentManager fragmentManager = getFragmentManager(); FragmentTransaction ft = fragmentManager.beginTransaction(); switch (position) { case 0://w ww .java2 s .com ft.replace(R.id.container, PeerListAcquisition.newInstance(position)); break; case 1: ft.replace(R.id.container, PeerListSubscription.newInstance(position)); break; case 2: ft.replace(R.id.container, Misc.newInstance(position)); break; } ft.commit(); }
From source file:com.amaze.carbonfilemanager.activities.PreferencesActivity.java
private void loadPrefFragment(PreferenceFragment fragment, @StringRes int titleBarName) { FragmentTransaction t = getFragmentManager().beginTransaction(); t.replace(R.id.prefsfragment, fragment); t.commit();/*from www. j a v a 2 s . c o m*/ getSupportActionBar().setTitle(titleBarName); }