title: How to set editText visible/invisible?
body: <p>In my program I want to be able to hide the edit text when a radio button is check and then reappear when the user clicks the other radio button.</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.waist2height); {
          final EditText h = (EditText)findViewById(R.id.editText2);          
          final RadioButton rCM = (RadioButton) findViewById(R.id.radioCM);
          final RadioButton rFT = (RadioButton) findViewById(R.id.radioFT);                       
          if(rCM.isChecked()){    
              h.setVisibility(View.VISIBLE);              
          }
          else if(rFT.isChecked()){               
              h.setVisibility(View.INVISIBLE);
          }}
  </code></pre>
  
  <p>The code below is where i have the problem i only added in the relevant part of my code instead of the entire thing </p>
  
  <pre><code>if(rCM.isChecked()){                    
      h.setVisibility(View.VISIBLE);                  
  }
  else if(rFT.isChecked()){                   
      h.setVisibility(View.INVISIBLE);
  } 
  </code></pre>
  
  <p>Unfortunately I can't seem to get it to work.
  Am I missing anything? Or have I got it all wrong altogether?
  I have tried <code>h.setVisibility(View.GONE);</code> however it just ruines the format of the xml.</p>