This project allows you to fill in meters and converts the value to inches.
- OnClickListener for submitting value when button clicked.
- Converting value to display.
This implemented the OnClickListener to respond to button presses on the UI. It was interesting placing the Layouts and TextViews, then having the OnClickListener process the input.
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
enterMeters = (EditText) findViewById(R.id.editText);
resultTextView = (TextView) findViewById(R.id.resultText);
convertButton = (Button) findViewById(R.id.convertButton);
convertButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
double multiplier = 39.37;
double result = 0.0;
...