Request Android, Currency Converter Updated

0

I'm new to android, I want to know how do I extract a url to have an always updated response to the application. If someone helps me wrap the code I thank

Code:

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;



public class MainActivity extends AppCompatActivity implements View.OnClickListener {

    private ViewHolder mViewHoldeer = new ViewHolder();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        this.mViewHoldeer.editValue = (EditText) findViewById(R.id.edit_value);
        this.mViewHoldeer.textDollar = (TextView) findViewById(R.id.text_dollar);
        this.mViewHoldeer.textEuro = (TextView) findViewById(R.id.text_euro);
        this.mViewHoldeer.buttonCalculate = (Button) findViewById(R.id.button_calculate);

        this.mViewHoldeer.buttonCalculate.setOnClickListener(this);

        this.clearValues();




    }



    @Override
    public void onClick(View view) {
        int id = view.getId();
        if (id == R.id.button_calculate) {
            Double value = Double.valueOf(this.mViewHoldeer.editValue.getText().toString());
            this.mViewHoldeer.textDollar.setText(String.format("%.2f ", value / 3.66));
            this.mViewHoldeer.textEuro.setText(String.format("%.2f ", value / 4.46));
        }
    }

    private void clearValues() {
        this.mViewHoldeer.textDollar.setText("");
        this.mViewHoldeer.textEuro.setText("");

    }


    private static class ViewHolder{
        EditText editValue;
        TextView textDollar;
        TextView textEuro;
        Button buttonCalculate;
    }

}
    
asked by anonymous 26.04.2018 / 18:30

0 answers