title: operator '<' cannot be applied to android.widget.textview int
body: <p>I am building an app that can calculate BMI and analyze the results, so I have a switch-case added to the app to help it give advice based on the result. I have the BMI result displayed on a text view which I have made invisible, but I keep getting the operator '&lt;' cannot be applied error in the case &lt;15 and case >40 region of the switch. I guess this as a result of the string value in the textview, How do I fix this?</p>
  
  <pre><code>public class MainActivity extends Activity{
  public final static String EXTRa_MESSAGE = " com.blogspot.bosolutionsonline.bosolutionsbmi.MESSAGE";
  EditText edit_height;
  EditText edit_weight;
  TextView ans;
  TextView ans2;
  int an2;
  Button bmi;
  double x=0;
  double y=0;
  double z=0;
  
  /**called when the activity is first created. */
  
  @Override
  public void onCreate(Bundle savedInstanceState)
  {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
      initControls();
  }
  private void initControls()
  {
   edit_height=(EditText)findViewById(R.id.edit_height);
   edit_weight=(EditText)findViewById(R.id.edit_weight);
   ans=(TextView)findViewById(R.id.ans);
   bmi=(Button)findViewById(R.id.bmi);
   bmi.setOnClickListener(new Button.OnClickListener() {
       public void onClick
               (View v) {
           bmi();
       }
   });
  }
  private void bmi(){
      x=Double.parseDouble(edit_height.getText().toString());
      y=Double.parseDouble(edit_weight.getText().toString());
      z=y/(x*x);
      ans.setText(Double.toString(z));
  
      ans.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
              switch (v.getId()){
                  case ans &lt; 15:
                  setContentView(R.layout.xml1);
                  break;
                  case 15:
                  case 16:
                      setContentView(R.layout.xml2);
                      break;
                  case 17:
                  case 18:
                      setContentView(R.layout.xml3);
                      break;
                  case 19:
                  case 20:
                  case 21:
                  case 22:
                  case 23:
                  case 24:
                  case 25:
                      setContentView(R.layout.xml4);
                      break;
                  case 26:
                  case 27:
                  case 28:
                  case 29:
                  case 30:
                      setContentView(R.layout.xml5);
                      break;
                  case 31:
                  case 32:
                  case 33:
                  case 34:
                  case 35:
                      setContentView(R.layout.xml6);
                      break;
                  case 36:
                  case 37:
                  case 38:
                  case 39:
                  case 40:
                      setContentView(R.layout.xml7);
                      break;
                  case ans &gt; 40:
                  setContentView(R.layout.xml8);
                  break;
  
              }
          }
      });
  
      }
  
   }
  </code></pre>