public void convertButtonOnClick(View view) { // findViewById will grab the UI (user interface) element by its ID EditText originalTempValue = findViewById(R.id.originalTempValue); String originalTempStr = originalTempValue.getText().toString(); // Double.parseDouble(string value) // String.valueOf( int/double value ) // convert the String originalTempStr to a double, and then // convert it to its celsius version with the formula: // celsius = (fahrenheit - 32) * 5/9 // and then, GRAB the other EditText and name it convertedTempValue, and use // convertedTempValue.setText( celsius (as a string) ) System.out.println(originalTempStr); }
Email me at ddjapri@ayclogic.com if you have any questions.