title: How to programmatically select RadioButton in an activity
body: <p>In my project, I get the value of the gender from the database as 0 and 1.<br>
  0 for male and 1 for female.<br>
  Based on this values, I need to check the corresponding RadioButton in a RadioGroup.<br>
  If 0 is pressed, radio0 will be checked or radio1 will be checked.<br>
  I don't know how to check the radio button based on this string values...<br>
  This is the code I tried:</p>
  
  <pre><code>      String gendd=ViewProfileActivity.participantview.get(4);
        System.out.println("Gender:::::"+gendd);
  
        male=(RadioButton)findViewById(R.id.radio0);
         female=(RadioButton)findViewById(R.id.radio1);
         if(gendd.equals("0")){
  
             male.setSelected(true);
             female.setSelected(false);
         }
         else
             {
             male.setSelected(false);
  
             female.setSelected(true);
  
             }
  </code></pre>
  
  <p>But it fails. Can anyone help me?</p>