Omar Omar - 7 months ago 37
Java Question

How to display calculations result in a hinted TextView in Android Studio/Java?

I am trying to create a simple converter that will convert the amount given in dollars to euros.

This is my component tree:

id: button - onClick: convert

id: input - EditText

id: output - TextView

My output field (which its id is "output" as well) is a TextView because I don't want the user to be able to write in it. Unless I figure out a way to reverse the calculations which at this time I do not know how to do.

My question is how to display euroamount - which is the result of calculations - in the TextView field - which its id is "output"?

This is my code:

public void convert (View view){
EditText input = (EditText) findViewById(;
Double usdamount = Double.parseDouble(input.getText().toString());
Double euroamount = usdamount * 0.88;


Thank you very much!

PS: I am a beginner so extensive explanation is appreciated!


You can do the following:

TextView output = (TextView) findViewById(;