code: void updateFragmentVisibility() {
          FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
          if (mCheckBox1.isChecked()) ft.show(mFragment1);
          else ft.hide(mFragment1);
          if (mCheckBox2.isChecked()) ft.show(mFragment2);
          else ft.hide(mFragment2);
          ft.commit();
      }
docs: Update fragment visibility based on current check box state.