title: Android Radio Buttons if or switch?
body: <p><img src="https://i.stack.imgur.com/I9iSO.png" alt="enter image description here"> </p>
  
  <p>Hey everyone, I am in need of some help with my first android app, and I have a little experience in programming. So first I wanted to do was something like "Let the user choose whichever method they want to convert from and to, and let them input the value in the TextView then follow by pressing the convert button to finish it with a toast."</p>
  
  <p>Currently I am having trouble with <code>onClickListener()</code> button to finish of with a toast output, I can't get the result from the String in switch/case. Also I am not sure that if my code is okay, as I cannot test it :(. I Spent hours trying to get it work but no luck. Need someone to point me to the right direction and what I need to look at, please.</p>
  
  <pre><code>    class convert_handler_CMtoM implements Button.OnClickListener {
  
      public void onClick(View v) {
  
          if (v == btnDisplay) {
  
              if (MMtoCM.isChecked())
              {
                  int Amount = (int) Float.parseFloat(et1.getText().toString());
                  int formula = (int) (Amount * 10) ; 
                  String result = String.valueOf(formula);
              }
  
              if (CMtoMM.isChecked())
              {
                  double Amount = (double)Float.parseFloat(et1.getText().toString());
                  double formula = (double) (Amount / 10) ; 
                  String result = String.valueOf(formula);
              }
          }
  
      }   
  
      private OnClickListener btnDisplay = new OnClickListener() {
          public void onClick(View v) {
              // Perform action on clicks
              RadioButton rb = (RadioButton) v;
              Toast.makeText(second.this, rb.getText(), result, Toast.LENGTH_SHORT).show();
          }
      };
  }
  </code></pre>