title: Android | Currency converter live rates
body: <p>I made a simple currency converter, but is there a simple way to retrieve live currency (just the currency, say from Israel shekel to dollar)? For example:</p>
  
  <pre><code>case R.id.euro:
          mDollar.setChecked(false);
          Meuro.setChecked(true);
          exchangeRate = **//live currency from external source**
          exchangeSymbol = "€";
  
          break;
  </code></pre>
  
  <p>Here is my whole code</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.activity_main);
  
      mResult = (TextView) findViewById(R.id.result);
      mToConvert = (EditText) findViewById(R.id.toConvert);
      mRadioGroup = (RadioGroup) findViewById(R.id.radioG);
      mDollar = (RadioButton) findViewById(R.id.dollar);
      Meuro = (RadioButton) findViewById(R.id.euro);
  
      mToConvert.addTextChangedListener(new TextWatcher() {
  
          @Override
          public void onTextChanged(CharSequence arg0, int arg1, int arg2,
                  int arg3) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void beforeTextChanged(CharSequence arg0, int arg1,
                  int arg2, int arg3) {
              // TODO Auto-generated method stub
  
          }
  
          @Override
          public void afterTextChanged(Editable arg0) {
              convertCurrentAmount();
  
          }
      });
      mRadioGroup
              .setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
  
                  @Override
                  public void onCheckedChanged(RadioGroup group, int checkedId) {
                      convertCurrentAmount();
                  }
              });
  }
  
  public void convertCurrentAmount() {
      double exchangeRate = -1;
      String exchangeSymbol = null;
      switch (mRadioGroup.getCheckedRadioButtonId()) {
      case R.id.dollar:
          mDollar.setChecked(true);
          Meuro.setChecked(false);
          exchangeRate = 3.76;
          exchangeSymbol = "$";
  
  
          break;
  
      case R.id.euro:
          mDollar.setChecked(false);
          Meuro.setChecked(true);
          exchangeRate = 5;
          exchangeSymbol = "€";
  
          break;
      }
      if (exchangeRate &gt; 0 &amp;&amp; exchangeSymbol != null) {
  
          Double stringtoint = Double
                  .valueOf(mToConvert.getText().toString());
          double result = stringtoint * exchangeRate;
          mResult.setText("" + exchangeSymbol + result);
  
      }
  }
  </code></pre>
  
  <p>}</p>