title: Change/Replace Fragments according to Radio button selection
body: <p>i have Activity which as two radio buttons 
  i want to change/replace fragments according to radio button selection</p>
  
  <pre><code>public class SignUp extends FragmentActivity implements OnCheckedChangeListener {
  
  RadioGroup rg;
  Signup_BloodBank sb;  //fragment 1
  Signup_User su;   //fragment 2
  android.support.v4.app.FragmentTransaction ft;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_sign_up);
  
      rg = (RadioGroup) findViewById(R.id.rg1);
      rg.setOnCheckedChangeListener(this);
  
      sb = new Signup_BloodBank();
      su = new Signup_User();
  
      RadioButton btn1 = (RadioButton)findViewById(R.id.rbBloodBank);
      btn1.setChecked(true);
      getSupportFragmentManager().beginTransaction().add(R.id.linear2, sb).commit();
  
  
  }
  
  @Override
  public void onCheckedChanged(RadioGroup group, int checkedId) {
  
      ft = getSupportFragmentManager().beginTransaction();
      switch (checkedId) {
      case R.id.rbBloodBank:
              ft.replace(R.id.linear2,sb);
      case R.id.rbUser:
          ft.replace(R.id.linear2,su);
          break;
  
      default:
          break;
      }
      ft.commit();
  }
  </code></pre>
  
  <p>}</p>
  
  <h2>Fragment1</h2>
  
  <pre><code>public class Signup_BloodBank extends Fragment {
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container,
              Bundle savedInstanceState) {
          // TODO Auto-generated method stub
          container.removeAllViews();
          return inflater.inflate(R.layout.fragment_sing_up__bb, null);
      }
  
  }
  </code></pre>
  
  <h2>Fragment2</h2>
  
  <p><code>public class Signup_User extends Fragment {
  @Override
  public View onCreateView(LayoutInflater inflater, ViewGroup container,
          Bundle savedInstanceState) {
      container.removeAllViews();
      return inflater.inflate(R.layout.fragment_sign_up__user, null);
  }
  }</code></p>