title: How to change text in the TextView according to the RadioButton selected?
body: <p>In my application i have </p>
  
  <ul>
  <li><strong>three <code>Edittext</code>s</strong>     and </li>
  <li><strong>one <code>RadioGroup</code></strong> <em>with</em> <strong>two <code>RadioButton</code>s</strong> and <strong>a <code>TextView</code></strong></li>
  </ul>
  
  <p>I need to do some calculation between the values of the **three <code>EditText</code>s and display the result in the <code>TextView</code>....
  I have put <code>TextWatcher</code> for the first two <code>EditText</code> so that the result is displayed simultaneously in this way..</p>
  
  <pre><code>  discount.addTextChangedListener(new TextWatcher(){
  
              @Override
              public void afterTextChanged(Editable arg0) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start,
                      int count, int after) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void onTextChanged(CharSequence s, int start,
                      int before, int count) {
                  // TODO Auto-generated method stub
                  display.setText(calFinance());
              }
  
          });
  
          assetCost.addTextChangedListener(new TextWatcher(){
  
              @Override
              public void afterTextChanged(Editable s) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void beforeTextChanged(CharSequence s, int start,
                      int count, int after) {
                  // TODO Auto-generated method stub
  
              }
  
              @Override
              public void onTextChanged(CharSequence s, int start,
                      int before, int count) {
                  // TODO Auto-generated method stub
                  display.setText(calFinance());
              }
  
          });
  </code></pre>
  
  <p>and this is the cal finance method where i am displaying the result in textview:</p>
  
  <pre><code>protected CharSequence calFinance() {
      // TODO Auto-generated method stub
      int c1,c2,c3,c4 = 0;
  
      if((assetCost.getText().toString() != "") &amp;&amp; (assetCost.getText().length() &gt; 0)){
          c1=Integer.parseInt(assetCost.getText().toString());
          as_Asset_Cost=assetCost.getText().toString();
      }else{
          c1=0;
      }
  
      if(discount.getText().toString() != "" &amp;&amp; discount.getText().length()&gt;0){
          c3 = Integer.parseInt(discount.getText().toString());
          as_Discount=discount.getText().toString();
      }else{
          c3=0;
      }
  
      if(rupees.isChecked()){
          if(marginalAmt.getText().toString() !="" &amp;&amp; marginalAmt.getText().length() &gt; 0){
              c2=Integer.parseInt(marginalAmt.getText().toString());
              as_Margin_Amount=marginalAmt.getText().toString();
  
              c4 =(c1 - c2 -c3);
              ma_Finance_Amount = display.getText().toString();
                          }else{
                              marginalAmt.setError("ERROR");
                          }
      }else if(percent.isChecked()){
                  if((marginalAmt.getText().toString() !="") &amp;&amp; (marginalAmt.getText().length() &gt; 0) &amp;&amp; (marginalAmt.getText().length() &lt;= 2)){
  
                          c2=Integer.parseInt(marginalAmt.getText().toString());
                          as_Margin_Amount=marginalAmt.getText().toString();
  
                          c4 = (c1*(1-(c2)/100))-c3;
                          ma_Finance_Amount = display.getText().toString();
  
                  }   else{
                      marginalAmt.setError("ERROR");  
                  }
      } else{
          c2 = 0;
          c4 = c1-c3;
          ma_Finance_Amount = display.getText().toString();
      }
      //return as_Asset_Cost;
  
      return String.valueOf(c4);
  
  
      }   
  </code></pre>
  
  <p>now according to what radio button is selected the result in the textview should change..
  as u can see in the <strong>calfinance()</strong> function the radio buttons rupees and percent is there for rupees the calculation is working but for percent its not...
  how do i solve this issue?? I cant seem to figure out what the problem is here...</p>