1.1 Fragments-1
1.1 Fragments-1
1.1 Fragments-1
Fragments
Lesson 1
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
fragmentTransaction
.add(R.id.fragment_container, fragment)
.addToBackStack(null)
.commit();
Removing a Fragment:
SimpleFragment fragment = (SimpleFragment) fragmentManager
.findFragmentById(R.id.fragment_container);
if (fragment != null) {
FragmentTransaction fragmentTransaction =
fragmentManager.beginTransaction();
fragmentTransaction.remove(fragment).commit();
}